1 view (last 30 days)

function main

so=1;

c=-1.25;

% a=1;

Pr=1;

%n=2;

n=input('n=') %%n=-0.3,-0.5

x=[1 1];

x1=fsolve(@solver,x);

function F=solver(x)

[t,u]=ode45(@equation,[0,20],[so c 1 x]);

s=length(t);

F=[u(s,2)-1; u(s,4)];

end

figure(1)

plot(t,u(:,4),'b-');

hold on

function dy=equation(t,y)

dy=zeros(5,1);

dy(1)=y(2);

dy(2)=y(3);

dy(3)=y(2)^2-y(1)*y(3)-1;

dy(4)=y(5);

dy(5)=Pr*(n*y(2)*y(4)-y(1)*y(5));

end

end

ERROR is

code is not running

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

Start Hunting!
## 21 Comments

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_674562

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_674562

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_674571

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_674571

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_674714

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_674714

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_674952

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_674952

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675117

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675117

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675248

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675248

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675285

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675285

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675321

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675321

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675325

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675325

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675326

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675326

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675335

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675335

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675352

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675352

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675364

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675364

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675369

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675369

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675374

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675374

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675416

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675416

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675504

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675504

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675670

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675670

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675788

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675788

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675918

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675918

## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675933

⋮## Direct link to this comment

https://au.mathworks.com/matlabcentral/answers/446712-previous-technique-didnt-work-for-the-present-code#comment_675933

Sign in to comment.