For loop invalid syntax problem, very frustrating.

5 次查看(过去 30 天)
I keep getting the error: "invalid syntax at 't' possibly a ),},or] is missing" I seriously have tried everything I can think of to fix this, but nothing works. help please.
for t = 1:250
Htheo(t)=4*(1-exp(-0.032t))
end

回答(2 个)

Roger Stafford
Roger Stafford 2015-4-14
Put an asterisk between the 0.032 and the 't':
Htheo(t)=4*(1-exp(-0.032*t))

Star Strider
Star Strider 2015-4-14
You’re missing a multiplication operator ‘*’. MATLAB doesn’t assume multiplication if no operator is stated.
This works:
for t = 1:250;
Htheo(t)=4*(1-exp(-0.032*t));
end

类别

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

Community Treasure Hunt

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

Start Hunting!

Translated by