フィルターのクリア

How can i modify this for loop to only give "integer indices values"?

1 回表示 (過去 30 日間)
Mohannad Abboushi
Mohannad Abboushi 2016 年 2 月 7 日
回答済み: Walter Roberson 2016 年 2 月 7 日
function[y]= hw3question1a(t,y)
y=1;
h=.02;
t=0;
f=(3*exp(-(4*t)))-2*y;
for i=1:50
t(i+1)=t(i)+h;
y(i+1)=y(i)+h*f(t(i),y(i));
plot(t,y,'r--')
xlabel('t'); ylabel('y')
title('Eulers Method for function question1')
end

採用された回答

Walter Roberson
Walter Roberson 2016 年 2 月 7 日
f = @(t,y) (3*exp(-(4*t)))-2*y;

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLoops and Conditional Statements についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by