please help i keep getting erro
2 views (last 30 days)
Show older comments
function sol=samsonwork
global Br Sc delta P K R n epsilon
%x=linspace(-1,1,11);
r=0:0.01:3;
Br=1;Sc=0.4;n=3;delta=0;R=0.5;epsilon=0.1;P=0.3;K=0.3;
solinit=bvpinit(r,[0,0,0,0,0,0]);
sol=bvp4c(@samsonfun,@samsonbc,solinit);
% plot(ans.x(1,:),ans.y(1,:))
end
function f=samsonfun(~,y)
% -Df*y(8)
global Br Sc delta P K R n epsilon g
g = y(3)/ (1+epsilon*y(3));
f=[y(2)
-P
y(4)
R*y(4)-Br*(y(2))^2+delta*(1+epsilon*y(3))* exp g
y(6)
Sc*K*(1+epsilon*y(3))^n *exp g];
end
function res=samsonbc(ya,yb)
%global s lambda alpha
res=[ya(1)
yb(1)-1
ya(3)
yb(3)
ya(5)-1
yb(5)];
end
3 Comments
Accepted Answer
Torsten
on 10 Mar 2023
samsonwork()
function sol=samsonwork
global Br Sc delta P K R n epsilon
%x=linspace(-1,1,11);
r=0:0.01:3;
Br=1;Sc=0.4;n=3;delta=0;R=0.5;epsilon=0.1;P=0.3;K=0.3;
solinit=bvpinit(r,[0,0,0,0,0,0]);
sol=bvp4c(@samsonfun,@samsonbc,solinit);
plot(sol.x,[sol.y(1,:);sol.y(2,:)])
% plot(ans.x(1,:),ans.y(1,:))
end
function f=samsonfun(~,y)
% -Df*y(8)
global Br Sc delta P K R n epsilon g
g = y(3)/ (1+epsilon*y(3));
f=[y(2)
-P
y(4)
R*y(4)-Br*(y(2))^2+delta*(1+epsilon*y(3))* exp(g)
y(6)
Sc*K*(1+epsilon*y(3))^n *exp(g)];
end
function res=samsonbc(ya,yb)
%global s lambda alpha
res=[ya(1)
yb(1)-1
ya(3)
yb(3)
ya(5)-1
yb(5)];
end
More Answers (0)
See Also
Categories
Find more on Linear Model Identification in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!