필터 지우기
필터 지우기

可以帮忙看一下为什么数据正常但画不出来图像吗?

조회 수: 9 (최근 30일)
子宸 白
子宸 白 2022년 12월 8일
댓글: Dongyue 2022년 12월 15일
我尝试使用plot画出在不同u之下的ode的解从直线逐渐分叉的图形,但是运行后数据正常,但图像一直是空白,可以帮忙看一下是哪里错了吗?谢谢大家了
这是作图函数:
u=0.8:0.001:1.2;
v=1;x0=1;w0=1;w=0.44;T=2*pi/w;
axis([0.9 1.2 -0.8 1])
hold on
for j=1:length(u)
[t,y]=ode23('zjzdfun',[0:T/100:70*T],[4,4],[],u(j),x0,w0,v,w);
plot(u(j),y(500:100:1400,2),'LineWidth',2);
end
这是主函数
function ydot=zjzdfun(t,y,~,u,x0,w0,v,w)
ydot=[y(2);
u*(x0^2-y(1)^2)*y(2)-w0^2*y(1)-v*cos(w*t)];
end
  댓글 수: 1
Dongyue
Dongyue 2022년 12월 15일
I am not sure whether your code will execute successfully. To me, the code should look like this:
clc; close all; clear;
u=0.8:0.001:1.2;
v=1;x0=1;w0=1;w=0.44;T=2*pi/w;
axis([0.9 1.2 -0.8 1])
j = 1; % use a for loop if you want
fun = @(t,y) zjzdfun(t,y,u(j),x0,w0,v,w);
[t,y] = ode23(fun,[0 70*T],[4,4]);
plot(t,y)
function ydot=zjzdfun(t,y,u,x0,w0,v,w)
ydot=[y(2);
u*(x0^2-y(1)^2)*y(2)-w0^2*y(1)-v*cos(w*t)];
end

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!