Can anyone help me to sort the following message error?

4 ビュー (過去 30 日間)
Avan Al-Saffar
Avan Al-Saffar 2015 年 5 月 20 日
コメント済み: Walter Roberson 2015 年 5 月 21 日
My code is :
function FA21May2015
x0=0.1;
omega = 1 ;
tspan =(0:0.1:50);
x = logisticOscilanalytical(tspan,x0,omega);
X = @(T) interp1(tspan,x,T);
f = @(tspan) ((omega.*cos(omega.*tspan) + sin(omega.*tspan).^2 .* (1- (2.*X(tspan)))).^2./ 2.*sin(omega.*tspan).^4 .* (X(tspan) - (X(tspan).^2)).^2);
t= (0:10:50);
t0 = t(1);
N = length(t);
Aall = zeros(1,N)
JTimeall = zeros(1,N);
for i = 1:N
Aall(i) = 1 / t(1,i) - t0
F = f * Aall
JTime = integral(F,0,t(1,i),'ArrayValued',true);
JTimeall(i)= JTime ;
end
figure(1)
plot(t,JTimeall,'r')
end
% function x = logisticOscilanalytical(t,x0,omega)
% ee = exp((omega)*(1-cos(omega*t)));
% x = (x0.* ee)./((x0+1) - x0.*ee);
% end
The message error is :
Undefined function 'mtimes' for input arguments of type 'function_handle'.
Error in FA21May2015 (line 19)
F = f * Aall.
I hope to find someone to sort this error please. Many thanks.

採用された回答

Walter Roberson
Walter Roberson 2015 年 5 月 21 日
  2 件のコメント
Avan Al-Saffar
Avan Al-Saffar 2015 年 5 月 21 日
編集済み: Avan Al-Saffar 2015 年 5 月 21 日
Many thanks for your answer. So you mean that I need to write :
F = f(tspan) .*Aall ?
But now I am getting this error( Error using .* Matrix dimensions must agree.
Error in FA21May2015 (line 21)
F = f(tspan).*Aall ;
Walter Roberson
Walter Roberson 2015 年 5 月 21 日
F = f(t).*Aall;
Aall was created to match the size of t, not the size of tspan.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by