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!