From: maurits on 19 May 2010 05:22 Hi I have a problem getting the 4 different graphs in one plot, see the code below: f=1.4; ro=1000; L=1.8; v2=0:0.01:4; h2=0.3; g=9.81; d=0.12; d2=0.3:0.1:0.6; Mu=zeros(length(d)); Pwand=zeros(length(v2)); h1=zeros(length(v2)); Q=zeros(length(v2)); for j=1:length(v2); i=1:length(d); Pwand(j)=f*ro*(L/d)*((v2(j)^2)/2); A=pi*(0.06)^2; Mu(i)= (pi*d2(i)^2)/A; if v2(j)>=0; d2(i)>=0; h1(j)=(((ro*v2(j)^2)/2)+(ro*g*h2)+(Pwand(j)))/(ro*g); Mu(i)= (pi*d2(i)^2)/A; end Q(i,j)=Mu(i)*A*v2(j); end plot(Q,h1) When i plot this i get a plot without any values, someone knows why? Thank you very much
From: Steven Lord on 19 May 2010 09:45 "maurits " <mauritssmalt(a)gmail.com> wrote in message news:ht0ajs$8r1$1(a)fred.mathworks.com... > Hi > I have a problem getting the 4 different graphs in one plot, see the code > below: *snip code* > When i plot this i get a plot without any values, someone knows why? Both Q and h1 are matrices. At least one of them should be a vector. Modify your code to make it so that one or both of them are vectors and plot the vectors. In the simplest case, this could be: plot(Q(:), h1(:)) When I ran this code, I received two lines -- one vertical and one horizontal, that lie along the X and Y axes of the plot. You need to determine, based on your knowledge of the code and the problem the code is intended to solve, whether that is the correct behavior and how to correct the code if it is not. -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ To contact Technical Support use the Contact Us link on http://www.mathworks.com
|
Pages: 1 Prev: how to automatically create "smart" files names Next: call output in function |