Plot issues

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Plot issues

이태훈
Hi, all
Sorry for a dummy question.
I have some problems with the plot.
I use this code .
>> function xdot  =F(x,t)
   D  =1.1;
   r  = 0.0984;
   ka =3;
   z  =10;
   umax=0.08;
   km =3;
   I0 =1;
   xdot(1)= (-x.*(D)).+((umax.*((I0.*2.717.^(-ka.*x.*z))./((I0.*(2.717.^(-ka.*x*z))).+km))).*x)
endfunction
>>
>>
>>
>> x0=9.8;
>>  t= linspace(0,50,100);
>>  quad("F",0,3);
I’ve got the xdot result.
But if I enter :plot(x,t)
error: 'x' undefined near line 1 column 6 comes out.
Can you tell me what the problem is ??
Best regards
Tae hoon lee






Reply | Threaded
Open this post in threaded view
|

Re: Plot issues

BGreen


On Thu, Apr 16, 2020 at 6:06 PM 이태훈 <[hidden email]> wrote:
Hi, all
Sorry for a dummy question.
I have some problems with the plot.
I use this code .
>> function xdot  =F(x,t)
   D  =1.1;
   r  = 0.0984;
   ka =3;
   z  =10;
   umax=0.08;
   km =3;
   I0 =1;
   xdot(1)= (-x.*(D)).+((umax.*((I0.*2.717.^(-ka.*x.*z))./((I0.*(2.717.^(-ka.*x*z))).+km))).*x)
endfunction
>>
>>
>>
>> x0=9.8;
>>  t= linspace(0,50,100);
>>  quad("F",0,3);
I’ve got the xdot result.
But if I enter :plot(x,t)
error: 'x' undefined near line 1 column 6 comes out.
Can you tell me what the problem is ??
Best regards
Tae hoon lee

You never defined a variable named x. What should x be?

Also, for what it's worth, the first input of the plot function is the independent variable, and the second is the dependent variable. I'm guessing you meant for t to be the independent variable.




Reply | Threaded
Open this post in threaded view
|

Re: Plot issues

BGreen

On Thu, Apr 16, 2020 at 7:31 PM 이태훈 <[hidden email]> wrote:

Thanks,
That’ right, my mistake. I want to see how the x changes over time. 
How should I define the x??? The x is the biomass, should I write the initial biomass value or make a function???


Please use "Reply all" so the entire mailing list can help. Also, in this mailing list we respond below the previous message rather than above.

Can you explain what it is you're trying to do? What is F? What variable are you trying to integrate it with respect to? I have no idea what biomass has to do with anything else.

I'm not sure if it's what you were asking, but when you call the plot function, the arguments should be arrays with the same length. For example,

n=100;
x = linspace(0,2*pi,n);
for j=1:n
y(j) = x(j)*sin(x(j));
end
plot(x,y)


Reply | Threaded
Open this post in threaded view
|

Re: Plot issues

이태훈
Dear. Brett
My purpose is to see how the x(biomass) changes over time.
The equation for biomass is  x=x0(initial biomass)*exp(u(growth rate)-D(dilution rate)*t). And the “u”(growth rate) can be substitute to u =I/(I+km). The “I”(light intensity) can be substitute I=I0*exp(x(biomass)*z(distance)*ka(absorbance coefficient))

The integration of the equation dx/dt=(u-D)x .
If I binomialize this, I get  ∫(1/x)dx(from x0 to x)=  ∫(u-D)dt(from t0 to t) .
And the result is x=x0*exp(u-D)*t. 

But when you substitute the “u” with  I/(I+ka) The right side  "∫(u-D)dt" can’t be integrated with respect to time because the light intensity changes over time.

So I  first tried with  eq . x=x0*exp((u-D)*t)  the ode45 to see how the  x changes over time.
What I’m doing now is to make a direct integration method to compare it with the numerical approach(Ode45).


2020. 4. 17. 오전 2:00, Brett Green <[hidden email]> 작성:


On Thu, Apr 16, 2020 at 7:31 PM 이태훈 <[hidden email]> wrote:

Thanks,
That’ right, my mistake. I want to see how the x changes over time. 
How should I define the x??? The x is the biomass, should I write the initial biomass value or make a function???


Please use "Reply all" so the entire mailing list can help. Also, in this mailing list we respond below the previous message rather than above.

Can you explain what it is you're trying to do? What is F? What variable are you trying to integrate it with respect to? I have no idea what biomass has to do with anything else.

I'm not sure if it's what you were asking, but when you call the plot function, the arguments should be arrays with the same length. For example,

n=100;
x = linspace(0,2*pi,n);
for j=1:n
y(j) = x(j)*sin(x(j));
end
plot(x,y)



Reply | Threaded
Open this post in threaded view
|

Re: Plot issues

soapkwan
Your "direct integration" means an analytical formula of X(t) as a function
of t, with several constant parameters, like ka, I0, x0...etc. Right?

If that is the case, then you may construct your function as:

Function x = F(t)
%define constant parameters
% x = your analytical formula
end

then depends what range of t you want, you may assign:

t = linspace(0,t_end,100);
x = F(t);
plot(x,y);




--
Sent from: https://octave.1599824.n4.nabble.com/Octave-General-f1599825.html