Lots of errors but code still runs fine?
조회 수: 3 (최근 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에서 Assumptions에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!