I need help to calculate the moments of a Chebyshev

4 ビュー (過去 30 日間)
jihen aouni
jihen aouni 2013 年 1 月 25 日
hello, I would like to calculate the moments Chebyshev image so I used the function ChebyshevPoly after I integrated in my code to calculate the moments (the name of the function is moment), but in the end the result I is all the time as result: 0. If you can help me understand my mistake or if you have a matlab code which computes the Chebyshev moments. These are the functions that I developed: ChebyshevPoly,moment,phi_j
function tk = ChebyshevPoly(n)
if n==0 tk = 1; elseif n==1 tk = [1 0]'; else
tkm2 = zeros(n+1,1);
tkm2(n+1) = 1;
tkm1 = zeros(n+1,1);
tkm1(n) = 1;
for k=2:n
tk = zeros(n+1,1);
for e=n-k+1:2:n
tk(e) = 2*tkm1(e+1) - tkm2(e);
end
if mod(k,2)==0
tk(n+1) = (-1)^(k/2);
end
if k<n
tkm2 = tkm1;
tkm1 = tk;
end
end
end
function out=phi_j(n,N) %PHI_J Summary of this function goes here % Detailed explanation goes here
%out=factorial(2*n)*[N+n; 2*n+1]; %out=factorial(N+n)/(2*n+1)*factorial(N-n); mol=1; for i=1:n, mol=mol*(N^2-i^2); end
out=(N^2*mol)/(2*n+1)*10^-6; end
function [ T_mn ] = moment( f,n,m) %MOMENT Summary of this function goes here % Detailed explanation goes here [N,M]=size(f); som=0; for x=1:N, for y=1:M,
% Polyval(ChebyshevPoly(n),x) som = som + (Polyval(ChebyshevPoly(n),x) * Polyval (ChebyshevPoly(m),y)* f(x,y)); end end
som; % phi_j(n,N) % phi_j(m,M) % 1/(phi_j(n,N) % 1/phi_j(m,M) % (1/(phi_j(n,N))*(1/phi_j(m,M))) T_mn=(1/(phi_j(n,N)*phi_j(m,M))).*som; end
thank you

回答 (0 件)

カテゴリ

Help Center および File ExchangeMathematics and Optimization についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by