MuPad and Symbolic Toolbox Error
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi, i want to ask a question about MuPad. I am beginner using MuPad,
I am trying to solve a coupled of ODE as follow using MuPad syntax:
eq := ode::solve({CA'(t)=-k1*CA(t)+k2*CB(t),CB'(t)=k1*CA(t)-k2*CB(t),CA(0)=3,CB(0)=0},{CA(t),CB(t)})
num := subs(eq,k1=0.5,k2=0.3)
So i get the answer as CA and CB.
But I am actually want to plot CA and CB as function of time. I am using plot command:
plot(num[1],t=0..10)
Error: unbound identifier(s) 'CB, CA' found [plot::Inequality::new]
and plotfunc2d function like this:
plotfunc2d(num[1],t=0..10)
Error: expecting an arithmetical expression or a function, got a 'DOM_LIST' for attribute 'Function' in Function2d object [plot]
I can't get the plot I want, and how can I get this? Do I have to type the solution obtained by solve command manually and use plotfunction2d or plot command?
And finally, I want to export these solution into MATLAB by using mupad command , getVar command, and matlabFunction command, but it yields errors. How can I do this?
Thank you very much
0 comentarios
Respuestas (1)
Walter Roberson
el 20 de Mayo de 2012
I think it might be,
ca := subs(CA, num[1]);
cb := subs(CB, num[1]);
plot([ca, cb], t=0..10);
However, this will depend on whether "num" is a single list or is a list of lists. The error message you get for plotfunc2d() would be consistent with "num" being a list of lists, which is what I coded for above.
2 comentarios
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!