作业帮 > 综合 > 作业

关于符号变量的分段函数

来源:学生作业帮 编辑:搜搜做题作业网作业帮 分类:综合作业 时间:2024/07/05 16:10:18
关于符号变量的分段函数
function D = fcn(ut)
syms r
c1=0.5;
c2=0.0014;
c3=1;
R=100;
persistent a;
if isempty(a)
a=0.07;
end
if diff(ut)>0
h=max(ut-r,a);
elseif diff(ut) 0
h=min(ut+r,a); %ut的极小值点
a=h;
elseif diff(ut,2) < 0
h=max(ut-r,a); %ut的极大值点
a=h;
end
end
pr=c1*exp(-c2*(r-c3)^2);
D=int(pr*h,r,0,R);
D=subs(D);
为啥说
为啥说没定义h呢 h不是中间变量吗 该怎么写呢
关于符号变量的分段函数
if isempty(a)
a=0.07;
end
h=[];
if diff(ut)>0
改成这样的试试,应该是在用h之前定义一个空矩阵