I was trying to solve this set of equations
and it appears the problem
what do i do?

5 件のコメント

Adriano Menga
Adriano Menga 2022 年 5 月 29 日
I set those equations with
Dyuman Joshi
Dyuman Joshi 2022 年 5 月 29 日
Show your full code. Not the photo of your code.
In which line does the error occur?
Adriano Menga
Adriano Menga 2022 年 5 月 29 日
Here
Davide Masiello
Davide Masiello 2022 年 5 月 29 日
Hi @Adriano Menga, in order for us to help, I suggest you copy-paste your entire code in your question.
You can use the "Insert code" button in the toolbar in order to show the code in a clear way (or use the Alt+Enter shortcut).
Adriano Menga
Adriano Menga 2022 年 5 月 29 日
clear all
clc
close all
a = 0.45;
b = 0.6;
c = 0:2;
d = 0.66;
e = 0.86;
f = 0.02;
g = 1.8;
h = 0.59;
l = 0.2;
m = 0.06;
n = 0.13;
o = 0.5;
T = 50;
dt = 1e-4;
ntot = ceil(T/dt);
x = zeros(1,ntot);
y = zeros(1,ntot);
z = zeros(1,ntot);
x(1) = 0.52;
y(1) = 0.15;
z(1) = 0.33;
for tt = 1:ntot
x(tt+1) = x(tt) + dt*(a*x(tt) + b*x(tt)^2 + c*x(tt)*y(tt) + d*x(tt)*z(tt));
y(tt+1) = y(tt) + dt*(e*y(tt) + f*y(tt)*x(tt) + g*y(tt)^2 + h*y(tt)*z(tt));
z(tt+1) = z(tt) + dt*(l*z(tt) + m*z(tt)*x(tt) + n*z(tt)*y(tt) + o*z(tt)^2);
end
figure(1)
h1 = plot((0:ntot)*dt,x,'b');
hold on
h2 = plot((0:ntot)*dt,y,'r');
h3 = plot((0:ntot)*dt,z,'k');
legend ([h1 h2 h3],'x','y','z')

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

 採用された回答

Dyuman Joshi
Dyuman Joshi 2022 年 5 月 29 日

0 投票

There's an error in defining c. It should be
c = 0.2

1 件のコメント

Adriano Menga
Adriano Menga 2022 年 5 月 29 日
Thank you very much. It was my fault

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by