資源簡介
MATLAB2017a的中文文檔,之前因為上傳權(quán)限問題分開為三個文件,現(xiàn)在權(quán)限夠了合成一個文件
代碼片段和文件信息
function?fftgui(x)
%FFTGUI??Demonstration?of?Finite?Fourier?Transform.
%??FFTGUI(x)?plots?real(x)?imag(x)?real(fft(x))?and?imag(fft(x)).
%??FFTGUI?without?any?arguments?uses?x?=?zeros(132).
%??When?any?point?is?moved?with?the?mouse?the?other?plots?respond.
%
%??Inspired?by?Java?applet?by?Dave?Hale?Stanford?Exploration?Project
%?????http://sepwww.stanford.edu/oldsep/hale/FftLab.html
if?nargin?==?0
???%?Default?initial?x?is?all?zeros.
???x?=?zeros(132);
end
if?~isempty(x)
???if?isequal(x‘reset‘)
??????%?Restore?original?data
??????x?=?get(0‘userdata‘);
??????set(gcf‘userdata‘x);
??????set(findobj(‘tag‘‘fftguirc‘)‘string‘‘close‘?...
?????????‘callback‘‘close(gcf)‘)
???else
??????%?Save?input?data.
??????x?=?x(:)‘;
??????set(0‘userdata‘x);
??????%?Initialize?figure.
??????clf?reset
??????set(gcf?...
????????‘doublebuffer‘‘on‘?...
????????‘name‘‘FFT?gui‘?...
????????‘menu‘‘none‘?...
????????‘numbertitle‘‘off‘?...
????????‘userdata‘x?...
????????‘units‘‘normalized‘?...
????????‘pos‘[.05?.25?.90?.65]?...
????????‘doublebuffer‘‘on‘?...
????????‘windowbuttondownfcn‘?...
????????‘fftgui([]);?set(gcf‘‘windowbuttonmotionfcn‘‘‘‘fftgui([])‘‘)‘?...
????????‘windowbuttonupfcn‘?...
????????‘set(gcf‘‘windowbuttonmotionfcn‘‘‘‘‘‘)‘)
??????uicontrol(‘tag‘‘fftguirc‘‘string‘‘close‘‘callback‘‘close(gcf)‘);
???end
???
???%?Initialize?four?subplots
???n?=?length(x);
???idx?=?1:n;
???y?=?fft(x);
???
???subplot(221)
???u?=?real(x);
???plot([0?n+1][0?0]‘k-‘?[idx;idx][0*u;u]‘c-‘?idxu‘b.‘‘markersize‘16)
???axis([0?n+1?-1?1])
???set(gca‘xtick‘[])
???set(gca‘ytick‘[])
???title(‘real(x)‘‘fontname‘‘courier‘‘fontweight‘‘bold‘)
???
???subplot(222)
???u?=?imag(x);
???plot([0?n+1][0?0]‘k-‘?[idx;idx][0*u;u]‘c-‘?idxu‘b.‘‘markersize‘16)
???axis([0?n+1?-1?1])
???set(gca‘xtick‘[])
???set(gca‘ytick‘[])
???title(‘imag(x)‘‘fontname‘‘courier‘‘fontweight‘‘bold‘)
???
???subplot(223)
???u?=?real(y);
???plot([0?n+1][0?0]‘k-‘?[idx;idx][0*u;u]‘c-‘?idxu‘b.‘‘markersize‘16)
???axis([0?n+1?-2?2])
???set(gca‘xtick‘[])
???set(gca‘ytick‘[])
???title(‘real(fft(x))‘‘fontname‘‘courier‘‘fontweight‘‘bold‘)
???
???subplot(224)
???u?=?imag(y);
???plot([0?n+1][0?0]‘k-‘?[idx;idx][0*u;u]‘c-‘?idxu‘b.‘‘markersize‘16)
???axis([0?n+1?-2?2])
???set(gca‘xtick‘[])
???set(gca‘ytick‘[])
???title(‘imag(fft(x))‘‘fontname‘‘courier‘‘fontweight‘‘bold‘)
??
else
???%?Respond?to?mouse?motion.
???x?=?get(gcf‘userdata‘);
???n?=?length(x);
???pt?=?get(gcf‘currentpoint‘);
???pos?=?get(gca‘pos‘);
???p?=?round((n+1)*(pt(1)-pos(1))/pos(3));
???q?=?2*(pt(2)-pos(2))/pos(4)-1;
???inplot?=?1?+?(pt(1)>.5)?+?2*(pt(2)<.5);
???if?(p?>?0)?&&?(p???????switch?inplot
?????????case?1?
????????????x(p)?=?q+i*imag(x(p));
????????????y?=?fft(x);
?????????case?2?
????????????x(p)?=?real(x(p))+i*q;
????????????y?=?fft(x);
?????????case?3
????????????y?=?fft(x);
????????????y(p)?=?2*q+i*imag(y(p));
??????????
評論
共有 條評論