Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Why they cant read my y value and it provide an empty graph?

Subject: Why they cant read my y value and it provide an empty graph?

From: Ng

Date: 11 Apr, 2013 15:00:16

Message: 1 of 6

Basically, i am trying to solve the equation, but it didn't come out with the graph.. the program run without the y value, that's why my graph is empty.. I wonder what happen to it.. can anyone please help? I need it urgently.. before 14/4. Thank you..

This is my function files:

function dy=overall_mb5(t,y);

global flow_in rho_p yp m T kd0 kd1 Arh1 Arh2 Ea3 k01 k02 k03 rho_ma rho_mb rho_mc d e yc_in ym_in yd_in;

m=(12966.27786/(900*y(1)+7745.6857*yp)); % total mass in reactor (kg)

% yh2_in from equation 18

yh2_in = 0.1104 - (1.855*10^8*y(4)/y(1))*(m*y(2)*d-0.02104*e);

PD = 6.8;

% equation to find k1

k1=k01+k02*T+k03*T^2;

% equation to find rho_m

rho_m=-rho_ma+rho_mb*T-rho_mc*T^2; %density of propylene monomer

% constant for yc*yh2/ym

Rp = k1*rho_m*m*0.02104

kd = kd0*exp(Arh1*T) + kd1*exp(Arh2*T);


dy = zeros(4,1);

dy(1) = (flow_in*((ym_in-y(1))-y(2))- Rp*y(2)*y(4)/y(1))/m
dy(2) = (flow_in*(yc_in-y(2)))/m - y(2)*(kd-kd1*exp(Arh2*T)*exp((-Ea3*y(1))/(0.02104*y(4))));
dy(3) = (flow_in*(yd_in-y(3)))/m + y(2)*(kd-kd1*exp(Arh2*T)*exp((-Ea3*y(1))/(0.02104*y(4))));
dy(4) = (flow_in*(yh2_in-y(4))- (PD*Rp/42.1)*(y(2)*y(4)/y(1))*(d+e*(0.02104*y(4)/y(1))))/m;

and this is my main file..

clear all

global flow_in rho_p yp m T kd0 kd1 Arh1 Arh2 Ea3 k01 k02 k03 rho_ma rho_mb rho_mc d e yc_in ym_in yd_in;

flow_in=1; %F the inlet mass flow rate in kg/h
rho_p=900; % Density of propylene in kg/m^3
yp = 0;
T=523.15; % temperature (K)

kd0=3746; % constant in h^-1
kd1=1.748*10^-7; % constant in h^-1
Arh1=1620.8; % Ea1/R in K
Arh2=5570.7; %Ea2/R in K
Ea3=498.9; % Ea3 is a constant value in Equation

k01=-204256.6; % constant to calculate k1
k02=1153.3314; % constant to calculate k1
k03=-1.626207; % constant to calculate k1

rho_ma=-263.7; % kg/m^3
rho_mb=6.827; % kg/K m^3
rho_mc=-0.0143; % kg/K^2 m^3

d = 1.52*10^-4;
e = 0.0405;

yc_in = 15.8*10^-3;
ym_in = 1;
yd_in =100*10^-3;





timerange = [0 3];
initialvalue = [0.81 0.006 0.215 0.5] ;

[t,y]=ode45(@overall_mb5,timerange,initialvalue);
plot(t,y);
%(:,1),'-',t,y(:,2),'-.',t,y(:,3),'-.',t,y(:,4),'-'
ylabel('mass (kg/h)');
xlabel('time (h)');

Subject: Why they cant read my y value and it provide an empty graph?

From: dpb

Date: 11 Apr, 2013 21:05:48

Message: 2 of 6

On 4/11/2013 10:00 AM, Ng wrote:
> Basically, i am trying to solve the equation, but it didn't come out
> with the graph.. the program run without the y value, that's why my
> graph is empty.. I wonder what happen to it.. can anyone please help? I
> need it urgently.. before 14/4. Thank you..
>
> This is my function files:
>
> function dy=overall_mb5(t,y);
...

Nothing in your function is dependent upon t...

doc ode45

--

Subject: Why they cant read my y value and it provide an empty graph?

From: Ng

Date: 12 Apr, 2013 00:31:08

Message: 3 of 6

dpb <none@non.net> wrote in message <kk78jc$pnl$1@speranza.aioe.org>...
> On 4/11/2013 10:00 AM, Ng wrote:
> > Basically, i am trying to solve the equation, but it didn't come out
> > with the graph.. the program run without the y value, that's why my
> > graph is empty.. I wonder what happen to it.. can anyone please help? I
> > need it urgently.. before 14/4. Thank you..
> >
> > This is my function files:
> >
> > function dy=overall_mb5(t,y);
> ...
>
> Nothing in your function is dependent upon t...
>
> doc ode45
>
> -- is it because it doesn't depends on t, that's why the graph cannot come out?

Subject: Why they cant read my y value and it provide an empty graph?

From: dpb

Date: 12 Apr, 2013 00:46:25

Message: 4 of 6

On 4/11/2013 7:31 PM, Ng wrote:
> dpb <none@non.net> wrote in message <kk78jc$pnl$1@speranza.aioe.org>...
>> On 4/11/2013 10:00 AM, Ng wrote:
>> > Basically, i am trying to solve the equation, but it didn't come out
>> > with the graph.. the program run without the y value, that's why my
>> > graph is empty.. I wonder what happen to it.. can anyone please help? I
>> > need it urgently.. before 14/4. Thank you..
>> >
>> > This is my function files:
>> >
>> > function dy=overall_mb5(t,y);
>> ...
>>
>> Nothing in your function is dependent upon t...
>>
>> doc ode45
>>
>> -- is it because it doesn't depends on t, that's why the graph cannot
>> come out?

If f(t) ==> not dependent on t, the y=Constant and there's nothing for
ODE45 to do...

--

Subject: Why they cant read my y value and it provide an empty graph?

From: Ng

Date: 12 Apr, 2013 03:10:08

Message: 5 of 6

dpb <none@non.net> wrote in message <kk7lh2$qnd$1@speranza.aioe.org>...
> On 4/11/2013 7:31 PM, Ng wrote:
> > dpb <none@non.net> wrote in message <kk78jc$pnl$1@speranza.aioe.org>...
> >> On 4/11/2013 10:00 AM, Ng wrote:
> >> > Basically, i am trying to solve the equation, but it didn't come out
> >> > with the graph.. the program run without the y value, that's why my
> >> > graph is empty.. I wonder what happen to it.. can anyone please help? I
> >> > need it urgently.. before 14/4. Thank you..
> >> >
> >> > This is my function files:
> >> >
> >> > function dy=overall_mb5(t,y);
> >> ...
> >>
> >> Nothing in your function is dependent upon t...
> >>
> >> doc ode45
> >>
> >> -- is it because it doesn't depends on t, that's why the graph cannot
> >> come out?
>
> If f(t) ==> not dependent on t, the y=Constant and there's nothing for
> ODE45 to do...
>
> --

oh i see.. thank you for the reply.. I will try to recheck my equation again :)

Subject: Why they cant read my y value and it provide an empty graph?

From: Ng

Date: 12 Apr, 2013 07:15:14

Message: 6 of 6

dpb <none@non.net> wrote in message <kk7lh2$qnd$1@speranza.aioe.org>...
> On 4/11/2013 7:31 PM, Ng wrote:
> > dpb <none@non.net> wrote in message <kk78jc$pnl$1@speranza.aioe.org>...
> >> On 4/11/2013 10:00 AM, Ng wrote:
> >> > Basically, i am trying to solve the equation, but it didn't come out
> >> > with the graph.. the program run without the y value, that's why my
> >> > graph is empty.. I wonder what happen to it.. can anyone please help? I
> >> > need it urgently.. before 14/4. Thank you..
> >> >
> >> > This is my function files:
> >> >
> >> > function dy=overall_mb5(t,y);
> >> ...
> >>
> >> Nothing in your function is dependent upon t...
> >>
> >> doc ode45
> >>
> >> -- is it because it doesn't depends on t, that's why the graph cannot
> >> come out?
>
> If f(t) ==> not dependent on t, the y=Constant and there's nothing for
> ODE45 to do...
>
> --

oh i see.. thank you for the reply.. I will try to recheck my equation again :)

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us