Why do I get the error Undefined function or variable 'f1_2'?
Show older comments
%define space from 0 to 2
x=linspace(0,2,11);
lambda=0.1;
%initial guess for the answer
guess= bvpinit(x,[1;0;0;0;1;0;1;0]);
%setting options
options = bvpset('Stats','on');
for i = 1:4
%calling bvp4c to solve the boundary value problem
sol=bvp4c(@bvp_func_3,@boundary_conditions,guess,options,lambda);
%export solution
f = sol.y;
if lambda==0.1
f1_1=f(1,:);
f2_1=f(2,:);
f5_1 = f(5,:);
X_1=sol.x;
else if lambda==0.3
f1_2=f(1,:);
f2_2=f(2,:);
f5_2=f(5,:);
X_2=sol.x
else if lambda==0.5
f1_3=f(1,:);
f2_3=f(2,:);
f5_3 = f(5,:);
X_3=sol.x;
else if lambda==0.7
f1_4=f(1,:);
f2_4=f(2,:);
f5_4 = f(5,:);
X_4=sol.x;
end
end
end
end
lambda=lambda+0.2;
end
lambda=lambda+0.1
sol=bvp4c(@bvp_func_3,@boundary_conditions,guess,options,lambda);
f = sol.y;
f1_5=f(1,:);
f2_5=f(2,:);
f5_5 = f(5,:);
X_5=sol.x;
%plotting the solutions of f with magentic parameter
figure
plot(X_1,f1_1,X_2,f1_2,X_3,f1_3,X_4,f1_4,X_5,f1_5)
legend('lambda=0.1','lambda=0.3','lambda=0.5','lambda=0.7','lambda=1')
xlabel('neta')
ylabel('f')
grid on
Accepted Answer
More Answers (0)
Categories
Find more on Physical Units 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!