blank plot with out value

1 次查看(过去 30 天)
shiv gaur
shiv gaur 2022-2-28
a(1)=1;
b(1)=1;
c(1)=1;
s1=0;
s2=0;
s3=0;
k3=28;
k1=8/3;
k2=10;
t=1:20;
for i=1:20
a(i+1)=(1/i+1)*(b(i)-a(i))*k2;
b(i+1)=(1/(i+1))*(a(i)*(k3-c(i))-b(i));
c(i+1)=(1/(i+1))*(a(i)*b(i)-k1*c(i));
end
for i=1:20
s1=s1+(a(i).*t.^i);
s2=s2+(b(i).*t.^i);
s3=s3+(c(i).*t.^i);
end
plot(t,s1)
pl you are req to plot the plot between t vs s1 may be data overflow so how to remove it
  2 个评论
David Hill
David Hill 2022-2-28
Describe the equations you are trying to plot. Current equations are going to inf and result in nan values in s1.
shiv gaur
shiv gaur 2022-2-28
this is lorenz equation which is change in power series a b c from x y z
a(i+1)=(1/i+1)*(b(i)-a(i))*k2;
b(i+1)=(1/(i+1))*(a(i)*(k3-c(i))-b(i));
c(i+1)=(1/(i+1))*(a(i)*b(i)-k1*c(i));

请先登录,再进行评论。

回答(2 个)

Image Analyst
Image Analyst 2022-2-28
I think you mean s1 vs. t. If so, maybe this is what you want:
a(1)=1;
b(1)=1;
c(1)=1;
s1=0;
s2=0;
s3=0;
k3=28;
k1=8/3;
k2=10;
t=1:20;
for k=1:20
a(k+1)=(1/k+1)*(b(k)-a(k))*k2;
b(k+1)=(1/(k+1))*(a(k)*(k3-c(k))-b(k));
c(k+1)=(1/(k+1))*(a(k)*b(k)-k1*c(k));
end
% Now make t (currently 20 long) the same length (21) as "a":
t = 1 : length(a);
for k=1: length(a)
s1(k+1) = s1(k) + (a(k) .* t(k) .^ k);
s2 = s2 + (b(k) .* t(k) .^ k);
s3 = s3 + (c(k) .* t(k) .^ k);
end
% Now make t (currently 22 long) the same length (22) as s1:
t = 1 : length(s1);
% Now plot
plot(t, s1, 'b-', 'LineWidth', 2)
grid on;
xlabel('t');
ylabel('s1')
  7 个评论
shiv gaur
shiv gaur 2022-2-28
is there any help to see the research paper and try to reproduce the fig5 ,4 of lorenz system which platform is use for helping

请先登录,再进行评论。


Walter Roberson
Walter Roberson 2022-2-28
You can remove that problem by using the symbolic toolbox for the calculations.
This will not be fast, but at least you will get some value instead of inf or nan. The values will probably reach the order of 10^26000 .
  3 个评论
shiv gaur
shiv gaur 2022-2-28
is there any help to see the research paper and try to reproduce the fig5 ,4 of lorenz system which platform is use for helping
Walter Roberson
Walter Roberson 2022-2-28
Original plot is blank because every value is so far out of range that it cannot be plotted. The second shows the log10 of the data -- it is obviously trending to the order of -10^5000
Reminder: your role is to show you things like the below, how to get extended range. Our role is not to do your research for you or examine papers to come up with the correct equations for you. We help you understand MATLAB; we mostly do not help you to understand the science or mathematics.
N = 20;
a = sym(zeros(N+1,1));
b = sym(zeros(N+1,1));
c = sym(zeros(N+1,1));
a(1) = 1;
b(1) = 1;
c(1) = 1;
s1 = sym(0);
s2 = sym(0);
s3 = sym(0);
k3 = sym(28);
k1 = sym(8)/3;
k2 = sym(10);
t = sym(1:N+1).';
for i=1:N
a(i+1)=(1/i+1)*(b(i)-a(i))*k2;
b(i+1)=(1/(i+1))*(a(i)*(k3-c(i))-b(i));
c(i+1)=(1/(i+1))*(a(i)*b(i)-k1*c(i));
end
for i=1:N
s1=s1+(a(i).*t.^i);
s2=s2+(b(i).*t.^i);
s3=s3+(c(i).*t.^i);
end
s1
s1 = 
vpa(s1)
ans = 
subplot(2,1,1);
plot(double(t), double(s1)); title('original')
subplot(2,1,2);
plot(double(t), double(log10(-s1))); title('log10')

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Calculus 的更多信息

产品


版本

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by