Issue with input arguements in a function

1 次查看(过去 30 天)
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 ??

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Performance and Memory 的更多信息

标签

产品

Community Treasure Hunt

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

Start Hunting!

Translated by