Why i am getting blank graph? Can someone help me to figure out error in my code.

1 回表示 (過去 30 日間)
Sharqa
Sharqa 2024 年 7 月 12 日
コメント済み: Sharqa 2024 年 8 月 16 日
function is_exam3
L=0.01;
M=0;
q=0.5;
a=0.03;
Pr=0.1;
b=0.2;
p=0.1;
m=0.1;
e=1.0;
H=0.1;
E=0.1;
o=0.1;
n=0.1;
B=0.1;
l=0.5;
q=0.1;
K=0.1;
S=0.3;
sol = bvpinit(linspace(0,1,100), [0 0 0 0 0 0]);
sol1 = bvp4c(@bvpexam3, @bcexam3, sol);
x = sol1.x;
y = sol1.y;
plot(x, y(2, :), 'LineWidth', 2)
end
function ysol = bvpexam3(x,y)
hold on
function res = bcexam3(y0, yinf)
S=0.3; L=0.01;b=0.2 ;K=0.1 ;B=0.1;
res = [y0(1); y0(2)-S+L*b*y0(3); K*y0(6)+B(1-y0(5)); yinf(2)-1;yinf(3); yinf(5)];
yy1 =((2*P)/q*(m+1)*y(1))*((b/p)*y(4)+(2*m/m+1)*(1-y(2)^2)+(q/p)*((3*m-1)*y(2)*y(4)+(3*m-1/2)*(y(3)^2)+(m-1)*y(3)*y(4))+M*exp^(-a)+y(1)*y(3));
yy2 =-((q*l)-r)/(K+n*(1+y(5))*((o-1)^3))*((3*n*(y(6)^2)*(o-1)/((q*l)-r)+(1+y(5)*(o-1)^2)+(2*Pr*H*y(5))/((q*l)-r)*(m+1)+Pr*y(1)*y(6)));
ysol = [y(2);y(3);y(4);yy1;y(6);yy2];
end
end

採用された回答

Torsten
Torsten 2024 年 7 月 12 日
is_exam3()
function is_exam3
L=0.01;
M=0;
q=0.5;
a=0.03;
Pr=0.1;
b=0.2;
p=0.1;
m=0.1;
e=1.0;
H=0.1;
E=0.1;
o=0.1;
n=0.1;
B=0.1;
l=0.5;
q=0.1;
K=0.1;
S=0.3;
P=1;
r=1;
sol = bvpinit(linspace(0,1,100), [0 0 0 0 0 0]);
sol1 = bvp4c(@bvpexam3, @bcexam3, sol);
x = sol1.x;
y = sol1.y;
plot(x, y(2, :), 'LineWidth', 2)
function ysol = bvpexam3(x,y)
yy1 =((2*P)/q*(m+1)*y(1))*((b/p)*y(4)+(2*m/m+1)*(1-y(2)^2)+(q/p)*((3*m-1)*y(2)*y(4)+(3*m-1/2)*(y(3)^2)+(m-1)*y(3)*y(4))+M*exp(-a)+y(1)*y(3));
yy2 =-((q*l)-r)/(K+n*(1+y(5))*((o-1)^3))*((3*n*(y(6)^2)*(o-1)/((q*l)-r)+(1+y(5)*(o-1)^2)+(2*Pr*H*y(5))/((q*l)-r)*(m+1)+Pr*y(1)*y(6)));
ysol = [y(2);y(3);y(4);yy1;y(6);yy2];
end
function res = bcexam3(y0, yinf)
res = [y0(1);y0(2)-S+L*b*y0(3);K*y0(6)+B*(1-y0(5));yinf(2)-1;yinf(3);yinf(5)];
end
end

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by