フィルターのクリア

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

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 Center および File ExchangeAnnotations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!