From: kk KKsingh on 23 Jul 2010 01:10 "kk KKsingh" <akikumar1983(a)gmail.com> wrote in message <i2b6vv$t0t$1(a)fred.mathworks.com>... > Walter Roberson <roberson(a)hushmail.com> wrote in message <i2ai3k$61n$1(a)canopus.cc.umanitoba.ca>... > > kk KKsingh wrote: > > > Walter Roberson <roberson(a)hushmail.com> wrote in message > > > <i2aein$rj$1(a)canopus.cc.umanitoba.ca>... > > >> kk KKsingh wrote: > > >> > > >> > I have a matrix which looks like (A*A) where A is Fourier Matrix,It > > >> need > to apply in this form > > >> > > (A* WA)^(inverse) * A*Wy; > > >> > > Where A* is conjugate of A > > > > > Its Conjugate Transpose > > > > Is the second dimension of A greater than the first dimension? If so then > > (A'*A) will not have an inverse, it appears. > > > > You mention that A is a Fourier Matrix, but other parts of your formulae > > become more natural to understand if A is a row vector rather than a matrix. > > Is A a 2D matrix? If so, then how were the fourier coefficients determined? > > For it to be a 2D fourier matrix would be suggestive of a 2D Fourier > > transform, but your mention of IDFT suggests that you are working in 1D not 2D. > > > > %This is to test codes > > > clear all; > close all; > N=1024; %Number of Sample points > Fs=1000;%Sampling Frequency > dt=1/Fs;%Sampling interval > fo=50;% Frequency of sin wave > t=0:dt:dt*(N-1);%Sampling Period > omega=2*pi*fo; > S=sin(omega*t); > > > > > %Applying FFT > f=fftshift(fft(S)); > > %Applying the decimation kernal > > pd=input('Enter the percent decimation') > if pd == 0 > W = ones(size(S)); > elseif pd ==1 > W = zeros(size(S)); > else > W = rand(size(S)); > W = W + (1-mean(W) - pd); > mean(W) > W = round(W); > end > > S1=W.*S; > %finding zeros from the signal > index=find(S1==0) > > %Removing zeros from the signal > S2=S1; > t2=t; > S2(index)=[]; > t2(index)=[]; > > > N1=numel(S2); > > freq_NDFT=Fs/N1*(-N/2:N/2-1); > S2=S2(:); > t2=t2(:); > freq_NDFT=freq_NDFT(:); > > > %Forward Fourier Transform > DFT=exp(-2*pi*i*freq_NDFT*t2'); > X_DFT=DFT*S2; > > > > > %------------------------------------------------------ > %Schonvillie NDFT is solved using Reinmann sum weights are > %used here > %NDFT Accoring to Schonvillie ¨ > N3=numel(S2); > Period=max(t2)-min(t2); > deltax_n=zeros(N1,1); > deltax_n(1,:)=((t2(2)-(t2(N1)-Period)))/2; > deltax_n(N1,:)=((t2(1)+Period)-(t2(N3-1)))/2; > for k=2:N1-1; > deltax_n(k,:)= ((t2(k+1)-t2(k-1))/2); > end > > %Now applying weights to the DFT > X_DFTw=DFT*(S2.*deltax_n) > > > > %Making inverse kernal > X_DFT_least= pinv(DFT*diag(deltax_n)*DFT')*X_DFTw; > > > > figure(1) > subplot(311) > plot(freq_NDFT,abs(X_DFT)) > legend('NDFT') > subplot(312) > plot(freq_NDFT,abs(X_DFTw)) > legend('NDFT with Weights') > subplot(313) > plot(freq_NDFT,abs(X_DFT_least)) > legend('Least Squares NDFT') > > Please let me know if there is any mistake ! Except bandlimitation i have done every thing ! I will band limit it by setting high frequency to zero.....will be taking only 20% samples > > kk So DFT is A, also I didnt normalise the amplitude it was needed ! And when it ask for decimation plz enter .20 as 20% or .N0 as N0% Do u see any mistake in the above code
From: kk KKsingh on 23 Jul 2010 01:46
"kk KKsingh" <akikumar1983(a)gmail.com> wrote in message <i2b87e$jag$1(a)fred.mathworks.com>... > "kk KKsingh" <akikumar1983(a)gmail.com> wrote in message <i2b6vv$t0t$1(a)fred.mathworks.com>... > > Walter Roberson <roberson(a)hushmail.com> wrote in message <i2ai3k$61n$1(a)canopus.cc.umanitoba.ca>... > > > kk KKsingh wrote: > > > > Walter Roberson <roberson(a)hushmail.com> wrote in message > > > > <i2aein$rj$1(a)canopus.cc.umanitoba.ca>... > > > >> kk KKsingh wrote: > > > >> > > > >> > I have a matrix which looks like (A*A) where A is Fourier Matrix,It > > > >> need > to apply in this form > > > >> > > (A* WA)^(inverse) * A*Wy; > > > >> > > Where A* is conjugate of A > > > > > > > Its Conjugate Transpose > > > > > > Is the second dimension of A greater than the first dimension? If so then > > > (A'*A) will not have an inverse, it appears. > > > > > > You mention that A is a Fourier Matrix, but other parts of your formulae > > > become more natural to understand if A is a row vector rather than a matrix. > > > Is A a 2D matrix? If so, then how were the fourier coefficients determined? > > > For it to be a 2D fourier matrix would be suggestive of a 2D Fourier > > > transform, but your mention of IDFT suggests that you are working in 1D not 2D. > > > > > > > > %This is to test codes > > > > > > clear all; > > close all; > > N=1024; %Number of Sample points > > Fs=1000;%Sampling Frequency > > dt=1/Fs;%Sampling interval > > fo=50;% Frequency of sin wave > > t=0:dt:dt*(N-1);%Sampling Period > > omega=2*pi*fo; > > S=sin(omega*t); > > > > > > > > > > %Applying FFT > > f=fftshift(fft(S)); > > > > %Applying the decimation kernal > > > > pd=input('Enter the percent decimation') > > if pd == 0 > > W = ones(size(S)); > > elseif pd ==1 > > W = zeros(size(S)); > > else > > W = rand(size(S)); > > W = W + (1-mean(W) - pd); > > mean(W) > > W = round(W); > > end > > > > S1=W.*S; > > %finding zeros from the signal > > index=find(S1==0) > > > > %Removing zeros from the signal > > S2=S1; > > t2=t; > > S2(index)=[]; > > t2(index)=[]; > > > > > > N1=numel(S2); > > > > freq_NDFT=Fs/N1*(-N/2:N/2-1); > > S2=S2(:); > > t2=t2(:); > > freq_NDFT=freq_NDFT(:); > > > > > > %Forward Fourier Transform > > DFT=exp(-2*pi*i*freq_NDFT*t2'); > > X_DFT=DFT*S2; > > > > > > > > > > %------------------------------------------------------ > > %Schonvillie NDFT is solved using Reinmann sum weights are > > %used here > > %NDFT Accoring to Schonvillie ¨ > > N3=numel(S2); > > Period=max(t2)-min(t2); > > deltax_n=zeros(N1,1); > > deltax_n(1,:)=((t2(2)-(t2(N1)-Period)))/2; > > deltax_n(N1,:)=((t2(1)+Period)-(t2(N3-1)))/2; > > for k=2:N1-1; > > deltax_n(k,:)= ((t2(k+1)-t2(k-1))/2); > > end > > > > %Now applying weights to the DFT > > X_DFTw=DFT*(S2.*deltax_n) > > > > > > > > %Making inverse kernal > > X_DFT_least= pinv(DFT*diag(deltax_n)*DFT')*X_DFTw; > > > > > > > > figure(1) > > subplot(311) > > plot(freq_NDFT,abs(X_DFT)) > > legend('NDFT') > > subplot(312) > > plot(freq_NDFT,abs(X_DFTw)) > > legend('NDFT with Weights') > > subplot(313) > > plot(freq_NDFT,abs(X_DFT_least)) > > legend('Least Squares NDFT') > > > > Please let me know if there is any mistake ! Except bandlimitation i have done every thing ! I will band limit it by setting high frequency to zero.....will be taking only 20% samples > > > > kk > > So DFT is A, also I didnt normalise the amplitude it was needed ! And when it ask for decimation plz enter .20 as 20% or .N0 as N0% > > Do u see any mistake in the above code 3. Also please see equation attaching another paper plz see equation 4 , equation 5 and equation 12...except bandlimtation i done every thing!...paste the below link in browser! http://docs.google.com/leaf?id=0B9lyGDKrglBfOGEyYzNiZjAtNWE2Zi00OWU1LThjN2YtNjgyZDFhOWFiOGYz&sort=name&layout=list&num=50 Thanks a lot for help and suggestions AK |