I wrote some function and I knew it is correct in matematics but I cann´t get eny output. Can you please help me?

3 次查看(过去 30 天)
function [h,hdot] = roadprofile(H,L,v,t);
H=0.2;
L=1;
v=(60/3.6);
t=1;
if t <= L/v;
h =(H/2)*(1-cos((2*pi*v*t)/L))
hdot =((H*pi*v)*sin((2*pi*v*t)/L))/L
elseif t > L/v;
h = 0;
hdot = 0;
end

回答(1 个)

Star Strider
Star Strider 2020-9-30
I cannot run your function because I have no idea what the arguments should be.
Hiowever one problem is obvious. One of the arguments is ‘t’, however you almost immediately overwrite it with:
t=1;
so the if block conditions never change.
Remove that line and you function will use the argument value you supply to it.

类别

Help CenterFile Exchange 中查找有关 Migrate GUIDE Apps 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by