call dsolve() equation as function for reference.
Afficher commentaires plus anciens
I have a dynamical system which i am implementing it does not always agree with what i am expecting because of random permutation. So i trying to use the diff function to give my system a nudge in the right direction when needed.
There for i have vreated this model below. when looking at what the returned equation is i get,
-1000/(51*(exp(log(97/102) - z/100) - 1))
how would i be able to insert the varable z to this equation with every itteration of a for loop? where the for loop argument is the point of time?
hold all;
clear all;
clc;
close all;
hold on
syms A(z)
B0 = 400;
N = 1000;
beta = 0.51;
gamma = 0.5;
Tend =100;
cond = A(0) == B0;
eqns = diff(A,z) == beta*(A/N)*(N-A)-gamma*A;
S = dsolve(eqns,cond);
fplot(S,[0 Tend],'y--','LineWidth',4)
a = S(1);
a(10)
I have modified the code getting a better result now but still cant figure this out.
hold all;
clear all;
clc;
close all;
hold on
syms A(z)
B0 = 400;
N = 1000;
beta = 0.51;
gamma = 0.5;
Tend =100;
cond = A(0) == B0;
eqns = diff(A,z) == beta*(A/N)*(N-A)-gamma*A;
S = dsolve(eqns,cond);
fplot(S,[0 Tend],'y--','LineWidth',4)
a(z) = S;
a(10)
a(10) now returns -1000/(51*(exp(log(97/102) - 1/10) - 1))
however i dont want the equation but rather the awnser how would i make this so that i get the solved awnser returned which would be 140.5405?
1 commentaire
Alex Mcaulley
le 20 Jan 2020
double(a(10))
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Calculus dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!