0% found this document useful (0 votes)
3 views2 pages

Final MATLAB Assignment

This document outlines a MATLAB assignment that involves creating and plotting two vectors based on a student ID and its reverse. The script includes commands for labeling, titling, and saving the plot as a JPG file. It demonstrates basic plotting techniques in MATLAB with a focus on visual representation of data.

Uploaded by

Qadeer Hussain
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views2 pages

Final MATLAB Assignment

This document outlines a MATLAB assignment that involves creating and plotting two vectors based on a student ID and its reverse. The script includes commands for labeling, titling, and saving the plot as a JPG file. It demonstrates basic plotting techniques in MATLAB with a focus on visual representation of data.

Uploaded by

Qadeer Hussain
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

MATLAB Assignment – Final Complete Script

Student Name: ____________________


Student ID: ____________________
Course Title: ____________________
Instructor Name: ____________________

Final MATLAB Script


clc;
clear;
close all;

% Declare vector X
X = [1 2 3 4 5 6 7 8 9];

% Declare vector Y1 using Student ID digits


Y1 = [2 1 0 3 4 5 6 7 8];

% Declare vector Y2 using reverse Student ID digits


Y2 = [8 7 6 5 4 3 0 1 2];

% Plot first line


plot(X, Y1, 'r-*');

% Hold figure for second plot


hold on;

% Plot second line


plot(X, Y2, 'b-*');

% Add labels
xlabel('X');
ylabel('Y1 and Y2');

% Add title
title('Student ID = MC210345678');

% Add legend
legend('My Student ID', 'MY Student ID in Reverse');

% Turn grid on
grid on;
% Save figure in JPG format
saveas(gcf, '[Link]');

Explanation
This MATLAB program creates two vectors using the student ID digits and their reverse
order. Both vectors are plotted on the same graph using different colors and asterisk
markers. The graph also contains labels, title, legend, and grid. Finally, the figure is saved in
JPG format.

You might also like