How to code a ramp function?
显示 更早的评论
Hi,
I tried to code a ramp function as attached herewith.
But getting an error
"Operands to the logical AND (&&) and OR (||) operators must be convertible to logical scalar values. Use the ANY
or ALL functions to reduce operands to logical scalar values."
Hence I need your valuable suggestion so as to run the same.
function r = ramp(t)
tstep = 10;
tmin = 0;
tmax = 10;
t = linspace(tmin,tmax,tstep);
if t<=4
H0=0.2*t;
end
if t>=5 && t<=7
H0=max(0,t);
end
if t>=8
H0=0.2*t;
end
plot(H0,t)
with regards,
rc
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Data Type Conversion 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!