Currently I have a a text file with data at the first row is formatted as follow: time;wave height 1;wave height 2;....... I have column until wave height 19 and rows total 4000 rows.
Data in the first column is time in second. From 2nd column onwards, it is wave height elevation which is in me开发者_开发知识库ter.
I would like to plot the follow:
on the x axis is time. the left hand side is wave height in m and on the right hand side is the distance between each measurment in a model.
inside the graph there are 4 plots, each plot is repersent waveight 1, wave height 2etc at a defined distance related to the right hand side y asix.
How would you code this in matlab?
I am a begineer, please if you could, it will be very useful to give a bit more explain in your answer! I was trying to post an picture up to clear things up but stackoverflow don't allow me to do that. If it is un clear please contact me and i can email you the graph i mean for this question.
Thank you!!!!!!!!!!
If you are have 2 sets of data of different units/scales, then you may use plotyy
. However, in the case you described here, it seems that mesh
may be a better choice, giving one a 3d grid surface, or plot3
, producing distinguish lines within a 3d space.
What do you mean the "distance between each measurment in a model" when talking about the y-scale on the right?
Given some data that looks like this:
#Time #Wave Height #Distance Between Measurements(?)
0000 1.00 1.00
0001 1.13 0.81
0003 1.58 0.73
... ... ...
4000 0.23 1.19
Where a vector containing all elements of the Time column is named times
, the vector with wave height is called waveHeights
, and the vector with distances is called distances
you could use plotyy()
in this way:
[AX,H1,H2] = plotyy(times,waveHeights,times,distances,'plot');
set(get(AX(1),'Ylabel'),'String','Wave Height')
set(get(AX(2),'Ylabel'),'String','Distance Between Measurements')
xlabel('Time (s)')
The first line is the actual plots and the last three add labels to the axes.
精彩评论