if we take the value of t from 1 to 100 then plot is ok but we take the value of time in reverse then plot is not able
wrong size is showing is there any method to take value in reverse to plot for example
t=100:1
t=zeros(100.1)
y=zeros(100.1)
for i=100:1
y(i)=sin(t(i))
plot(t,y)
end
plot is not showing

 採用された回答

Arif Hoq
Arif Hoq 2022 年 2 月 26 日

0 投票

i think you don't need a loop here
t=100:-1:1;
y=sin(t);
plot(t,y)

4 件のコメント

shiv gaur
shiv gaur 2022 年 2 月 26 日
why value on x axis forom 1 to 100 we want the value from 100 to 1
Arif Hoq
Arif Hoq 2022 年 2 月 26 日
just put this line
set(gca,'XDir','reverse')
Arif Hoq
Arif Hoq 2022 年 2 月 26 日
you need to x axis direction in reverse
t=100:-1:1;
y=sin(t);
plot(t,y)
set(gca, 'XDir','reverse')
shiv gaur
shiv gaur 2022 年 2 月 26 日
you are req to apply this in this equation
sigma = 10;beta = 8/3;rho = 28;f = @(t,a) [-sigma*a(1) + sigma*a(2); rho*a(1) - a(2) - a(1)*a(3); -beta*a(3) + a(1)*a(2)];[t,a] = ode45(f,[0 100],[1 1 1]); plot3(a(:,1),a(:,2),a(:,3))
set(gca,'XDir','reverse')

サインインしてコメントする。

その他の回答 (0 件)

製品

リリース

R2021b

タグ

質問済み:

2022 年 2 月 26 日

コメント済み:

2022 年 2 月 26 日

Community Treasure Hunt

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

Start Hunting!

Translated by