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
0 个评论
回答(1 个)
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Migrate GUIDE Apps 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!