why is it not graphing my plot? im getting the data but no data points on my graph

2 次查看(过去 30 天)
function prob8=project8(~,V)
Fa=V(1);
Fb=V(2);
Fc=V(3);
Fd=V(4);
Fe=V(5);
Fg=V(6);
Fw=V(7);
k1=0.014;
k2=0.007;
k3=0.014;
k4=0.45;
% molar flow rates in mol/s
Fao=10;
Fbo=5;
%volumetric flow rate dm^3/s
vo=100;
%total concentration in mol/dm^3
Cto=0.147;
%volume in dm^3
V=1000;
Ft=Fao+Fbo;
%Total molar flow%
Ft=Fa+Fb+Fc+Fd+Fe+Fg+Fw;
%defining each concentration%
Ca=Cto*(Fa/Ft);
Cb=Cto*(Fb/Ft);
Cc=Cto*(Fc/Ft);
Cd=Cto*(Fd/Ft);
Ce=Cto*(Fe/Ft);
Cg=Cto*(Fg/Ft);
Cw=Cto*(Fw/Ft);
ra=(-k1*Ca*(Cb^(1/2)))-(k2*Ca^2);
rb=-0.5*k1*Ca*(Cb^(1/2));
rc=(k1*Ca*(Cb^(1/2)))-(k3*Cc)-(k4*Cd);
rd=(0.5*k2*((Ca^2)))-(k4*Cd);
re=k3*Cc;
rg=k4*Cd;
rw=k3*Cc;
prob8(1)=ra;
prob8(2)=rb;
prob8(3)=rc;
prob8(4)=rd;
prob8(5)=re;
prob8(6)=rg;
prob8(7)=rw;
prob8=prob8';
%calling the functiin project8 to solve for each value%
prob8o=[10 5 0 0 1*10^(-16) 0 1*10^(-16)];
Vspan=[0 1000];
[V,y]=ode45('project8',Vspan, prob8o)
plot(V,prob8o(:,1));
hold on
plot(V,prob8o(:,2));
hold on
plot(V,prob8o(:,3));
hold on
plot(V,prob8o(:,4));
hold on
plot(V,prob8o(:,5));
hold on
plot(V,prob8o(:,6));
hold on
plot(V,prob8o(:,7));
legend('Fa','Fb','Fc','Fd','Fe','Fw','Fg')
title ('Flowrate Vs Volume of Reactor')
xlabel('Volume(dm3)')
ylabel('Flowrate (mol/s)')

采纳的回答

Star Strider
Star Strider 2018-7-22
First, you need to call the function correctly, so use the ‘@’ operator to create a function handle in your ode45 call.
Second, you need to plot the correct variables. Those are the ‘V’ vector and the ‘y’ matrix your ode45 call returns.
Your ‘project8’ function works correctly, so you only need to change the call to it, and the variables you plot.
Try this:
% calling the function project8 to solve for each value %
prob8o=[10 5 0 0 1*10^(-16) 0 1*10^(-16)];
Vspan=[0 1000];
[V,y]=ode45(@project8,Vspan, prob8o);
plot(V,y)
legend('Fa','Fb','Fc','Fd','Fe','Fw','Fg')
title ('Flowrate Vs Volume of Reactor')
xlabel('Volume(dm3)')
ylabel('Flowrate (mol/s)')

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Lighting, Transparency, and Shading 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by