Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- syms q a x
- f=a(q+1)*x(2)^q
- y(2) = symsum(f, q, 0, m)
- % Inputs , for example x=[1,2,3,..,10] and a=[5,6,7,8]
- x=1:10
- a=[5,6,7,8]
- % m <= length(a)
- m=3
- % temporary matrices
- [tx,ta] = meshgrid(x,a)
- [~,tm]=meshgrid(x,0:m)
- t=ta(1:m+1,:).*tx(1:m+1,:).^tm(1:m+1,:)
- % y is your result and has equal elemnts to x matrix
- y=sum(t,1)
- % some outputs
- y(2)
- y(3)
Add Comment
Please, Sign In to add comment