The file my data. csv contains plotting data for three functions. When the file
ID: 3572453 • Letter: T
Question
The file my data. csv contains plotting data for three functions. When the file is loaded into Matlab as a matrix, columns 1, 2, and 3 contain the y-coordinates of the three functions, and column 4 contains the x-coordinates common to all three functions. Write a Matlab script (not a function!) called sampleplot.m that reads in data from the file my data. csv, assigns it to a matrix, then plots each of the first 3 columns of the matrix against the fourth column. Your final plot should look like the one shown below with all the corresponding colors, line styles, and labeling information.Explanation / Answer
The below matlab script will plot the data fetched from the mydata.csv:
sampleplot.m :
-------------
data=csvread('mydata.csv'); % This will read the .csv file
y=data(:,1,2,3); % reading its 1st,2nd & 3rd column
x=data(:,4); % reading its 4th column of csv file
plot(y,x); % ploting 1st,2nd & 3rd column vs 4th column
NOTE: Since i didn't had the contents of mydata.csv, i couldn't get you the plot. But, the plot will be similar to the above one in the question available.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.