Plotting [1,n) cell arrays against each other

Hi guys,
Iv been writing up a program for estimation of rotor power, however, i need to output a graph plot of thrust coeff against pitch angle. Iv got my results out of a for loop based program as two 1 x n (n is defined as between 15 and 30) cell arrays. Iv used the following code:
graph = plot(EffCT,Theta1);
axis([5 30 1 3]);
set(graph,'Color','red','LineWidth',2)
But it only opens the figure window with no line in sight, and im sure by axis are correctly sized as iv reviewed the arrays. If you could help me out id really appreciate it.
Cheers Mark

2 Comments

So EffCT and Thetal are cell arrays? What do the cells look like? Is each cell a single value, like this:
X = num2cell(1:5)
If so, I am surprised that call to plot doesn't error. Please show what these two variables are. Cell arrays (so describe the contents) or doubles?? Maybe even give a small sample for us to look at.
I may be wrong in calling them cell arrays, I get a what looks like a 1xn matrix as an output eg
EffECT equals - ( 1.2 1.5 1.3)
Sorry about the format, im on the move and my phone has limited functions

Sign in to comment.

 Accepted Answer

Matt Fig
Matt Fig on 27 Nov 2012
Edited: Matt Fig on 27 Nov 2012
Try your code without calling the AXIS function. Judging by your data you do not have cell arrays, you have numeric arrays and you're setting the limits beyond the range of the data.
I.e., try this:
graph = plot(EffCT,Theta1);
% axis([5 30 1 3]);
set(graph,'Color','red','LineWidth',2)

6 Comments

Doesn't work I'm afraid. Is it possible there is something wrong witht the format of the data? Both sets of data have been output from an iterated for loop, I'm probably way off but just tryin to figure it out...
Well, just paste the data here since you say it is only 15-30 elements long. Let's look at it.
Ok, Im getting data in this form:
EffCT = [1.036138479 1.26394386 1.38788723 1.42886344 1.59734342 1.73894262 1.79621365 1.85198124 1.91267812 2.01267137 2.12712476 2.39072137 2.48961235 2.58712468 2.61249078]
Theta1 = [16 17 18 19 20 21 22 23 24 25 26 27 28 29 30]
Yet when I try and plot it, I just get empty axis.
O.k., are you sure about what you are doing? Because it works fine here:
>> clear all,close all
>> EffCT = [1.036138479 1.26394386 1.38788723,...
1.42886344 1.59734342 1.73894262,...
1.79621365 1.85198124 1.91267812,...
2.01267137 2.12712476 2.39072137,...
2.48961235 2.58712468 2.61249078]
>> Theta1 = [16 17 18 19 20 21 22 23 24 25 26 27 28 29 30]
>> graph = plot(EffCT,Theta1);
>> set(graph,'Color','red','LineWidth',2)
Ill have to try tommorow, will comment when i get the chance to have another go. Thanks a lot for helping this far.
Had a try again today after going through the code removing other bugs and it worked so, mystery not solved but now it works so im good. Thanks for your help.

Sign in to comment.

More Answers (0)

Asked:

on 27 Nov 2012

Community Treasure Hunt

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

Start Hunting!