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!