Why am I getting "Undefined operator '*' for input arguments of type 'cell'." when I run this code?

1 次查看(过去 30 天)
Why would multiplication need to be defined in the last equation in my code but not in the ones above it?
if true
format long
a = 1
b = 3*10^-7
c = 5*10^-8
f0 = 4*10^9
sigma = 0.2
t0 = 0
tmax = 2*b
t = 6*10^-9
omega = 2*pi*f
omega0 = 2*pi*f0
yt = a*exp((-(t-b)^2)/((2*c)^2));
Ff = sqrt(pi/2)*a*c*exp(-7.8957e+05 - 7.5398e+03i)*[erfi(4.2426)-erfi(-4.2426)]
Zf = (sqrt(-1)*sqrt(pi/2)*((a*c*sigma)/4)*exp(-((2*pi*f+omega0)*(c^2*(2*pi*f+omega0)+2*sqrt(-1)*b))))*{-exp(4*pi*c^2*f*omega0+2*sqrt(-1)*b*omega0)*[erfi(((tmax-b+sqrt(-1)*c^2)*(2*pi*f-omega0))/(sqrt(2)*c))-erfi(((t0-b+sqrt(-1)*c^2)*(2*pi*f-omega0))/(sqrt(2)*c))]+[erfi(((tmax-b+sqrt(-1)*c^2)*(2*pi*f+omega0))/(sqrt(-1)*c))-erfi(((t0-b+sqrt(-1)*c^2)*(2*pi*f+omega0))/(sqrt(-1)*c))]}
% code
end
This is the code I'm trying to run and it is able to solve all the way up to Ff. I'm confused.

采纳的回答

Sean de Wolski
Sean de Wolski 2015-8-5
You use a { which creates a cell array (container). You probably want to use a [ or ( instead.
  5 个评论
Zakia wani
Zakia wani 2016-11-23
编辑:Zakia wani 2016-11-23
i am getting same error.. Undefined operator '*' for input arguments of type 'cell'. for this code
f= open ('c1.fig');
sp1data = findobj(subplot(4,3,1), 'Type', 'line');
y1 = get (sp1data,'Ydata');
T1 = (-0.3164*y1+161.84);
i tried to use .* instead of only * it still shows same error.. how to multiply then
Walter Roberson
Walter Roberson 2016-11-23
Your findobj is finding multiple objects. When you have multiple objects in a get then the output is returned in a cell array. Cell arrays cannot be multiplied but you could use cellfun to multiply the entries producing a cell array of results.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

标签

尚未输入任何标签。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by