matlab报错,The integrand function must return an output vector
来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/10/06 12:12:30
matlab报错,The integrand function must return an output vector of the same length ...序如下
syms f ;
la1=1310*10^-9;
c=3*10^8;
x=0; %光程差
f1=c/la1;
df=3.4*10^12; %谱宽
la2=1311*10^-9;
f2=c/la2;
t=sqrt(exp((-(f-f1)*(f-f1)-(f-f2)*(f-f2))/(2*df*df)))*cos(2*pi*x*f/c)/(sqrt(2*pi)*df);
y=quad(@(f) t,2.273076335877862*10^14,2.305329519450801*10^14)
报错:Error using quad (line 79)
The integrand function must return an output vector of the same length as the input vector.
syms f ;
la1=1310*10^-9;
c=3*10^8;
x=0; %光程差
f1=c/la1;
df=3.4*10^12; %谱宽
la2=1311*10^-9;
f2=c/la2;
t=sqrt(exp((-(f-f1)*(f-f1)-(f-f2)*(f-f2))/(2*df*df)))*cos(2*pi*x*f/c)/(sqrt(2*pi)*df);
y=quad(@(f) t,2.273076335877862*10^14,2.305329519450801*10^14)
报错:Error using quad (line 79)
The integrand function must return an output vector of the same length as the input vector.
la1=1310*10^-9;
c=3*10^8;
x=0; %光程差
f1=c/la1;
df=3.4*10^12; %谱宽
la2=1311*10^-9;
f2=c/la2;
t=@(f)abs(sqrt(exp((-(f-f1).*(f-f1)-(f-f2).*(f-f2))./(2.*df.*df))).*cos(2*pi*x*f/c)./(sqrt(2*pi)*df));
y=integral(t,2.273076335877862*10^14,2.305329519450801*10^14)
y =
0.3646
再问: 你的integral函数智能用在2012a和以上版本吧,我的2011b版本不支持这个函数貌似,还是报这个错:Undefined function 'integral' for input arguments of type 'function_handle'. 请问为什么函数要加个取绝对值的,中间为什么换成点乘
再答: 我的是2012b版本。加绝对值是为了把开平方运算的结果取单值。
c=3*10^8;
x=0; %光程差
f1=c/la1;
df=3.4*10^12; %谱宽
la2=1311*10^-9;
f2=c/la2;
t=@(f)abs(sqrt(exp((-(f-f1).*(f-f1)-(f-f2).*(f-f2))./(2.*df.*df))).*cos(2*pi*x*f/c)./(sqrt(2*pi)*df));
y=integral(t,2.273076335877862*10^14,2.305329519450801*10^14)
y =
0.3646
再问: 你的integral函数智能用在2012a和以上版本吧,我的2011b版本不支持这个函数貌似,还是报这个错:Undefined function 'integral' for input arguments of type 'function_handle'. 请问为什么函数要加个取绝对值的,中间为什么换成点乘
再答: 我的是2012b版本。加绝对值是为了把开平方运算的结果取单值。
matlab报错,The integrand function must return an output vector
matlab求定积分报错The integrand function must return an output vec
matlab报错Z must be a matrix, not a scalar or vector,哪里出错了?
matlab报错Function definitions are not permitted at the prompt
Matlab Simulink中的 S函数报错,One or more output arguments not ass
matlab报错One or more output arguments not assigned during cal
matlab 非线性拟合 求指导 MODELFUN should return a vector of fitted v
matlab报错:In an assignment A(i,j) = B,the number of columns i
matlab function
matlab程序运行错误 “Z must be a matrix,not a scalar or vector.”
matlab 为什么会出现Z must be a matrix,not a scalar or vector
What is the output of the main function? Can you explain why