Issue with input arguements in a function

5 ビュー (過去 30 日間)
Carl
Carl 2011 年 9 月 13 日
No matter how I change the function highlighted at the bottom I cannot get rid of the error: ??? Error using ==>@(f,t,n) Too many input arguments. I have read through Mathworks help description and examples of function arguments and I do not see a error in this function. Any help on this would be greatly appreciated.
syms t k n
evalin(symengine,'assume(k,Type::Integer)');
f = @(t)evalin(symengine,['subs(piecewise([0 <= t and t < 2,',...
'sin((Pi*t^2)/4)],[t <= 2 and t < 3, 5*t-t^2-6], [t <=3 and t < 4, 0],',...
'[Otherwise, t-4]),t=',regexprep(mat2str(x),' ',','),')']);
a = @(f,t,k) int(f*cos(k*pi*t/4)/4,t,-2,8);
b = @(f,t,k) int(f*sin(k*pi*t/4)/4,t,-2,8);
ERROR OCCURS HERE
fs = @(f,t,n) a(f,t,0)/4 + ...
symsum(a(f,t,k)*cos(k*pi*t/4) + b(f,t,k)*sin(k*pi*t/4),k,1,n);
g = fs;
pretty(fs(g,t,25,1))
ezplot(fs(g,t,25,1),-2,8)
hold on
ezplot(f,-2,8)
hold off
title('Partial sum with n=25')

採用された回答

Walter Roberson
Walter Roberson 2011 年 9 月 13 日
Urrr -- you are aware that just 2 and 3 lines down, you call fs with four arguments instead of 3 ??
  1 件のコメント
Carl
Carl 2011 年 9 月 13 日
Crap. Always the most obvious things that are overlooked.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePerformance and Memory についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by