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 Center および File ExchangeLoops and Conditional Statements についてさらに検索

タグ

タグが未入力です。

Community Treasure Hunt

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

Start Hunting!

Translated by