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

1 visualización (últimos 30 días)
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.

Respuesta aceptada

Sean de Wolski
Sean de Wolski el 5 de Ag. de 2015
You use a { which creates a cell array (container). You probably want to use a [ or ( instead.
  5 comentarios
Zakia wani
Zakia wani el 23 de Nov. de 2016
Editada: Zakia wani el 23 de Nov. de 2016
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 el 23 de Nov. de 2016
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.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Community Treasure Hunt

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

Start Hunting!

Translated by