From: James on
I'm very much a beginner with this software so I'm having a great bit of difficulting getting my plotyy to work properly. Also, it's not plotting a function but rather the data resulting from a function.

the range is defined by the user (0 to input) and a new point is generate while the loop is true. however, I get no such graph (I've plotted it all seperately, but that is not what is being asked of me).

Help me...please :*(
From: Herve on
Without your code (and error message if any), it will be difficult to help you.
From: James on
"Herve " <michaud_rene(a)yahoo.fr> wrote in message <hf2evv$19j$1(a)fred.mathworks.com>...
> Without your code (and error message if any), it will be difficult to help you.

you want the whole code? o_0.... ok...here's the first plotyy and loop

t=0; % initialize
i=0; %initialize
Vi=7827940.847; %acre-ft, starting value
Cin=13846; %mg/L , starting value
Ci=44000; %mg/L, starting value
SA=354; %mi^2, starting value
h=3.4610647155E-4*SA^2 + 3.2026054057E-2*SA - 2.7509792352E+2; % ft below sea level
E=5.75; %fr/year avg yearly value
Qin=1332500; %arce-ft/year
hold on;

plotyy(i,Ci,i,h);
[AX,H1,H2= plotyy(i,Ci,i,h,'plot');
set(get(AX(1),'Ylabel'),'String','mg/L') ;
set(get(AX(2),'Ylabel'),'String','ft') ;
y1label=get(h1axes(1),'Concetration');
y2label= get(h2axes(2),'height');
set(y2label,'String','\height')
xlabel('years');


disp('Currently the Salton sea has a salt concetration of (mg/L) ')
disp(Ci)
disp('and a height (feet below sealevel) of ')
disp(h);
disp('The volume is (acre-ft)');
disp(Vi);
t=input('Over how many years do you want to calculate the concetration and height of the Salton Sea? ');
disp('Senairo (A); flow in remain unchanged, so yearly volume remains constant');
while(1);
if i>t, break,end
i=i+1;
SA=1.9107280750E-5*Vi + 2.0540966155E+2;
h=3.4610647155E-4*SA^2 + 3.2026054057E-2*SA - 2.7509792352E+2; % ft below sea level
Ci=Ci+(Qin*Cin)/Vi;
plot(i,Ci,h);
end

I can do this plot with all 4 plots on one (I've done it) but with the numbers being orders of magnitude in different, the smaller one shows no change even though there is a MASSIVE change. I just started the plotyy after being informed of the requirements (otherwise I would have don't subplot)

The first error is... but I know there is more wrong with my plotyy, as with preivous incarnation would go to completion but show nothing.

??? Undefined function or method 'AX' for input arguments of type 'double'.

Error in ==> saltonseaproject at 14
set(get(AX(1),'Ylabel'),'String','mg/L') ;
From: Herve on
> plotyy(i,Ci,i,h);
> [AX,H1,H2= plotyy(i,Ci,i,h,'plot');
> set(get(AX(1),'Ylabel'),'String','mg/L') ;
> set(get(AX(2),'Ylabel'),'String','ft') ;
> y1label=get(h1axes(1),'Concetration');
> y2label= get(h2axes(2),'height');
> set(y2label,'String','\height')
> xlabel('years');

[AX,H1,H2]= plotyy(i,Ci,i,h,'plot'); % You had forgotten a bracket ]
set(get(AX(1),'Ylabel'),'String','Concentration (mg/L)') ;
set(get(AX(2),'Ylabel'),'String','Height (ft)') ;
xlabel('Years');

> while(1);
> if i>t, break,end
> i=i+1;
> SA=1.9107280750E-5*Vi + 2.0540966155E+2;
> h=3.4610647155E-4*SA^2 + 3.2026054057E-2*SA - 2.7509792352E+2; % ft below sea level
> Ci=Ci+(Qin*Cin)/Vi;
> plot(i,Ci,h);
> end

Then I suggest that you save your data in arrays...
while(1);
...
x(i) = i
SA(i) = ...
h(i) = ...
Ci(i) =...
i = i+1;
end

and then you plot your data...
plotyy(x,Ci,x,h)

By doing this, you use the function plot only once...
From: James on
thanx... turns out I didn't know plotyy needed an array to read from. once I was educated, it wasn't an issue. but thanks!
 | 
Pages: 1
Prev: Solving an ODE
Next: modifying ert_main