函数的符号乘法

时间:2017-07-12 09:43:50

标签: matlab

尝试将符号函数与符号积分相乘时出错:

eta02=vpa(-i*omega2/((i*alpha2*lambda_0)^(2/3)),prec); %whatever
eta_inf2=vpa(vpa(((i*alpha2*lambda_0)^(1/3))*YMAX,prec)+eta02,prec); %whatever
%% 
syms lu
syms x
myairyf(lu)= airy(lu);
mybairyf(lu)=airy(2,lu);

Gi2(x)=-(mybairyf*int(myairyf,lu,[eta_inf2,(x)])-myairyf*int(mybairyf,lu,[eta02,(x)]));


Error using sym/subsindex (line 769)
Invalid indexing or function definition. When defining a function, ensure that the arguments are symbolic variables and the body of the
function is a SYM expression. When indexing, the input must be numeric, logical, or ':'.

如何做到这一点?另外,我如何绘制Gi2(x),因为它是象征性的?

1 个答案:

答案 0 :(得分:0)

使用symfun功能。

Gi2 = sumfun(-(mybairyf*int(myairyf,lu,[eta_inf2,(x)])-myairyf*int(mybairyf,lu,[eta02,(x)])), x);

现在Gi2(val)将评估值'val'的函数

然后可以通过评估此函数来绘制要绘制的值,将它们存储在矢量中,并绘制x和y值,从而完成绘图。

xvals = linspace(0,10,100);
yvals = Gi2(xvals);

figure
plot(xvals,vals)