How can i find the norm error btw a function and a summation?

1 次查看(过去 30 天)
Hello! i wanna do this summation with some sample x's.
x_j's are givin int he formula amd they change in the summation acording to summation index.
x is an unknown in the summation but i have to assign a vector to x and this vector should be like this x=0:2pi/100:2pi and my summation have to be a vector at the end(or it have not be im not sure)
Also i have to calculate u(x) (e.g. u(x)=x )for the same x values. Cause at the end i will calculate the norm of the error |Summation-u(x)| at this sample x points an draw x vs this norm graph.
Can someone help me please?
Thanks!!
Here is my code i think formulation is correct bu i dont know how to insert x values in to the code
clc
clear all
f= @(x) x;
N=4;
x_d=0:2*pi/100:2;
for j=0:N
x_j(j+1,1)=(2*pi*j)/(N+1);
I(j+1,1)=f(x_j)*sin((N+1)*(x_d-x_j)/2)/sin((x_d-x_j)/2);
end
I_n=(1/(N+1))*sum(f(:,1));
(x_d are sample points)

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by