call dsolve() equation as function for reference.
이전 댓글 표시
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
Alex Mcaulley
2020년 1월 20일
double(a(10))
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Calculus에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!