Monday, 15 August 2011

plot - Plotting in Matlab by splitting up matrices -



plot - Plotting in Matlab by splitting up matrices -

i have 2 vectors xline , yline 63 values in each, have derived previous calculations. out of these 63 values, first 21 values of xline represent x co-ordinates of line , yline y co-ordinates. next 21 values sec line , on.

how go splitting these 63 values 3 separate lines , plot them on xy graph in matlab?

plot(reshape(xline,[21 3])', reshape(yline,[21 3])') should trick . perchance don't need transpose both - can never remember how matlab likes multi-line plots.

this because matlab stores matrices row-first: when reshape array, create multiple rows (becomes columns) , plot command figures out want there.

matlab plot

No comments:

Post a Comment