Info

この質問は閉じられています。 編集または回答するには再度開いてください。

New to MATLAB so need help with following

1 回表示 (過去 30 日間)
Muhammad Islam
Muhammad Islam 2019 年 6 月 28 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Given the following equation,
Capture.PNG
Given, d0=0.1 & d1=0.01 and model depends on value of b.
If x0=10 I need to investigate behavior of xn for large n for b = 0.1, 0.2, 2.3, 2.6, 3
Can anyone help me with the syntax I need to do this? There are many more situations I need to consider but if I can get this one syntax, I will be able to understand the rest.
  2 件のコメント
darova
darova 2019 年 6 月 28 日
I CAN help you. What difficulties do you have?
Jan
Jan 2019 年 7 月 2 日

回答 (2 件)

Basil C.
Basil C. 2019 年 6 月 29 日
編集済み: Basil C. 2019 年 6 月 29 日
You could first declare an array of x element knowing that you need to find value upto X(6)
clc
clear all
close all
N=6; %if you want to find the value of x(6)
x=zeros(1,N); %declare an array
Declare the given data
b=0.1; % change the value of b accordingly
d0=0.1;
d1=0.01;
x(1)=10; %this stores the value of x0
Then use a for loop to find the value
for n=1:N-1
x(n+1)=x(n)+b*x(n)-d0*x(n)-d1*x(n)^2;
end
The value upto x6 will be stored in the array 'x'

Image Analyst
Image Analyst 2019 年 6 月 29 日
You need a loop over b outside the computation of the x vector:
d0=0.1;
d1=0.01;
x(1)=10; % First x
N = 5; % or however long you want the final x to be.
b = [0.1, 0.2, 2.3, 2.6, 3]
for k = 1 : length(b)
for n = 1 : length(x) - 1
x(n+1) = x(n) + b(k) * x(n) - d0*x(n) - d1 * x(n)^2;
end
% Now do something with x, like plot it or whatever.
end

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by