Plotting 150 datapoints on a 360datapoint scale.

Hey
How do you plot an extracted list having 150 datapoints against a 360 datapoints x-scale? If you would do it in Excel, one would have to insert zeros in those empty cells. In matlab, would using vectors work? If not, what would be the best and easiest answer?
Thanks
Ferd

댓글 수: 5

Friedrich
Friedrich 2012년 3월 14일
Do you know to which x value each of your 150 datapoints belongs to?
Lets say i have as
x = [1 2 3 4 5]
and as
y = [10 20]
How do you know to which x value the y value corresponds?
Thomas
Thomas 2012년 3월 14일
can you show an example of your data? Do you mean to say you have 360 values in x and 150 values in Y and are plotting(x,y)?
Ferd
Ferd 2012년 3월 14일
I have an extracted list, P(x1,y1),P(x2,y2)...P(x150,y150) points. Next, I would like to plot these points on a global axis system I created. A 360x360(x,y-axes say) axes. How do you plot it in this graph? (The x,y parameters matches to the global axis name). For plotting, I was thinking about Polar coordinate system, but I believe in doing so, you would also need the other points outside the extracted list points, which are zeros, to obtain a zero distance relative to the origin.
Thomas
Thomas 2012년 3월 14일
Seems like you need to interpolate the datapoints as mentioned by Wayne below..
Ferd
Ferd 2012년 3월 14일
Yea, I'm trying all the different methods. (lol...)
Appreciate the advice and answers though.
Thanks

댓글을 달려면 로그인하십시오.

답변 (1개)

Wayne King
Wayne King 2012년 3월 14일

0 개 추천

You can do the same thing as in Excel, you can upsample the vector by two and plot that.
Or you can interpolate to get an estimate of what the data vector is on a finer grid.
If you have the Signal Processing Toolbox, there is function upsample()
t = 1:300;
x = randn(150,1);
y = upsample(x,2,0);
stem(t,y);
To interpolate, you can use interp1().
t = 1:1/2:150;
x = randn(150,1);
t1 = 1:150;
y = interp1(t1,x,t);
plot(t,y);
There are a number of supported interpolation methods. You should choose which is most appropriate for you use case.

댓글 수: 2

Ferd
Ferd 2012년 3월 14일
Hey Wayne,
I believe both answers would modify the final output to get it in the required box of 360points. However, I have those final points. Next, i would like to plot that 150 (x,y)points on a 360x360 global plot. Both the extracted list and the global plot have same axis units. i am thinking just a vector subtraction w.r.t origin might be ok to get both matrices in the same order.
Ferd
Ferd 2012년 3월 19일
Hey
No positive results yet.
I have two channels, Timings and fuel-in. The Timing matrix ranges from -12 to +10 (dbtdc) and my fuelling is in mg/stroke. Both the matrices are 160x1. Now, I have created a new CAD scale from -180 to +180(degrees) having an interval of 1degree(360x1)Matrix. I intend to plot the Timing channel on my newly created CAD scale so as to get data for only the fuelling event to be represented on the -180 to 180 cycle.
Thanks

댓글을 달려면 로그인하십시오.

태그

질문:

2012년 3월 14일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by