How to code a ramp function?
Show older comments
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
Accepted Answer
More Answers (0)
Categories
Find more on Data Type Conversion in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!