Lots of errors but code still runs fine?
1 回表示 (過去 30 日間)
古いコメントを表示
Hello,
I'm fairly new to Matlab and I wrote this scrip so solve a homework problem of mine. However when I run it I get a lot of errors that start on line 71 but my code only has 47 lines and it still runs perfectly fine. Can anyone tell me what might be going wrong and how I get rid of these errors. Thanks a lot!
clc
clear all
close all
fun=@(t,x) x.^3+x.^2-12*x;
figure (1)
fplot(@(x) fun(0,x),[-5,5])
grid on
xlabel('x'); ylabel('f(x)');
title('Function plot')
fp= solve(fun) % fixed point
[T X] = meshgrid(0:0.1:5, -5:0.1:5);
dY = fun(T,X);
dT = ones(size(dY));
L=sqrt(1+dY.^2);
figure (2)
quiver(T,X, dT./L, dY./L,0.5);
axis tight
xlabel('Time(t)'); ylabel('x(t)')
title('Stability graph')
[t1,x1] = ode45(fun,[0 5],0.1);
figure(3)
plot(t1,x1)
xlabel('Time (t)'); ylabel('x');
title('Solution at initial point x=0.1')
0 件のコメント
採用された回答
KALYAN ACHARJYA
2018 年 9 月 8 日
編集済み: KALYAN ACHARJYA
2018 年 9 月 8 日
%No Code Error
clc;
clear all;
close all;
fun=@(t,x) x.^3+x.^2-12*x;
figure, fplot(@(x) fun(0,x),[-5,5])
grid on
xlabel('x'); ylabel('f(x)');
title('Function plot')
fp=solve(fun) % fixed point
[T X]=meshgrid(0:0.1:5, -5:0.1:5);
dY=fun(T,X);
dT=ones(size(dY));
L=sqrt(1+dY.^2);
figure, quiver(T,X, dT./L, dY./L,0.5);
axis tight
xlabel('Time(t)'); ylabel('x(t)')
title('Stability graph')
[t1,x1]=ode45(fun,[0 5],0.1);
figure,plot(t1,x1)
xlabel('Time (t)'); ylabel('x');
title('Solution at initial point x=0.1')
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Calculus についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!