作业帮 > 综合 > 作业

分段函数在MATLAB中定义函数

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/13 09:00:57
分段函数在MATLAB中定义函数
function y=f(a)
if a=0:0.01:1
f(a)=1
end
if a=1:0.01:3
f(a)=1-5.*(a-0.1)
end
else
f(a)=0
end
为什么调用时不行
y=f(7)
Error:File:E:\练习册\Matlab\f.m Line:3 Column:5
The expression to the left of the equals sign is not a valid target for an assignment.
f(a)=1错了,还有if else if else end 是这样的组合.
再问: function y=f(a)

if a>=0 && a=0 && a