please help me please i want draw plot ..

1 Ansicht (letzte 30 Tage)
rollcakes
rollcakes am 3 Dez. 2015
Kommentiert: rollcakes am 4 Dez. 2015
function DRAW
N=800;
M=700;
handles.fig=figure();
mpos=get(handles.fig,'position');
set(handles.fig,'units','pixel');
set(handles.fig,'position',[mpos(3)-120 mpos(4)-370 N M]);
handles.axes1=axes();
set(handles.axes1,'units','pixel');
handles.axes1=subplot(4,2,1);
handles.axes2=axes();
set(handles.axes2,'units','pixel');
handles.axes2=subplot(4,2,3);
handles.axes3=axes();
set(handles.axes3,'units','pixel');
handles.axes3=subplot(4,2,5);
handles.axes4=axes();
set(handles.axes4,'units','pixel');
handles.axes4=subplot(4,2,7);
handles.axes5=axes();
set(handles.axes5,'units','pixel');
handles.axes5=subplot(4,2,2);
handles.filter1=uicontrol('style','radiobutton');
set(handles.filter1,'string','low pass');
set(handles.filter1,'position',[500 460 150 20]);
handles.filter2=uicontrol('style','radiobutton');
set(handles.filter2,'string','highpass');
set(handles.filter2,'position',[500 440 150 20]);
handles.filter3=uicontrol('style','radiobutton');
set(handles.filter3,'string','band pass');
set(handles.filter3,'position',[500 420 150 20]);
handles.list=uicontrol('style','listbox');
set(handles.list,'position',[500 320 150 100]);
set(handles.list,'string', 'rect | cos | exp');
set(handles.filter1,'callback',{@mycallback, handles, 1});
set(handles.filter2,'callback',{@mycallback, handles, 2});
set(handles.filter3,'callback',{@mycallback, handles, 3});
set(handles.list,'callback',{@list_callback,handles});
function list_callback(gcf, event_data, handles)
handles.list=get(handles.list,'value');
t=[-5*pi : 0.01 : 5*pi];
if(handles.list==1)
plot(handles.axes1,t,rectpuls(t/4));
xlabel(handles.axes1,'t(sec)');
title(handles.axes1,'rect');
Fs=1/0.01;
x=rectpuls(t/4);
Xf=fft(x);
Xfs=fftshift(Xf);
N=length(Xf);
f=[0:N-1]*(Fs/N)-(Fs/2);
plot(handles.axes5,f,Xfs);
axis(handles.axes5, [-20 20 -150 150]);
xlabel(handles.axes5,'frequency(hz)');
title(handles.axes5,'rect FT');
elseif(handles.list==2)
plot(handles.axes1,t,cos(t));
xlabel(handles.axes1,'t(sec)');
title(handles.axes1,'cos');
Fs=1/0.01;
x=cos(t);
Xf=fft(x);
Xfs=fftshift(Xf);
N=length(Xf);
f=[0:N-1]*(Fs/N)-(Fs/2);
plot(handles.axes5,f,Xfs);
axis(handles.axes5, [-20 20 -150 150]);
xlabel(handles.axes5,'frequency(hz)');
title(handles.axes5,'cos FT');
elseif(handles.list==3)
plot(handles.axes1,t,exp(t));
xlabel(handles.axes1,'t(sec)');
title(handles.axes1,'exp');
Fs=1/0.01;
x=exp(t);
Xf=fft(x);
Xfs=fftshift(Xf);
N=length(Xf);
f=[0:N-1]*(Fs/N)-(Fs/2);
plot(handles.axes5,f,Xfs);
axis(handles.axes5, [-20 20 -150 150]);
xlabel(handles.axes5,'frequency(hz)');
title(handles.axes5,'exp FT');
end
function mycallback(gcf, event_data, handles, filter_num)
switch filter_num
case 1
set(handles.filter1,'value',1);
set(handles.filter2,'value',0);
set(handles.filter3,'value',0);
N=64;
fc=0.4;
A=1;
t=([0:N-1]-(N-1)/2);
f=(1/N)*[-N/2:N/2-1];
P=A*sin(2*pi*fc*t)./(pi*t);
plot(handles.axes2,t,P);
xlabel(handles.axes2,'t(sec)');
ylabel(handles.axes2,'LP');
title(handles.axes2,'Low Pass Filter impulse');
PF=fftshift(abs(fft(P)));
plot(handles.axes3,f,PF);
xlabel(handles.axes3,'frequency(hz)');
ylabel(handles.axes3,'Filter');
title(handles.axes3,'Low Pass Filter frequency');
case 2
set(handles.filter1,'value',0);
set(handles.filter2,'value',1);
set(handles.filter3,'value',0);
N=64;
fc=0.3;
A=1;
t=([0:N-1]-(N-1)/2);
f=(1/N)*[-N/2:N/2-1];
P=((-1).^t)*A.*sin(2*pi*(0.5-fc)*t)./(pi*t);
plot(handles.axes2,t,imag(P));
xlabel(handles.axes2,'t(sec)');
ylabel(handles.axes2,'HP');
title(handles.axes2,'High Pass Filter impulse');
PF=fftshift(abs(fft(P)));
plot(handles.axes3,f,PF);
xlabel(handles.axes3,'frequency(hz)');
ylabel(handles.axes3,'Filter');
title(handles.axes3,'High Pass Filter frequency');
case 3
set(handles.filter1,'value',0);
set(handles.filter2,'value',0);
set(handles.filter3,'value',1);
N=64;
fl=0.2;
fh=0.3;
f=(1/N)*[-N/2:N/2-1];
n=[0:N-1];
I=find(((f>=fl)&(f<=fh))|((f>=-fh)&(f<=-fl)));
PF=zeros(1,N);
PF(I)=ones(1,length(I));
BPP=ifft(PF);
plot(handles.axes2,n,real(BPP));
xlabel(handles.axes2,'t(sec)');
ylabel(handles.axes2,'BP');
title(handles.axes2,'Band Pass Filter impulse');
plot(handles.axes3,f,PF);
xlabel(handles.axes3,'frequency(Hz)');
ylabel(handles.axes3,'Filter');
title(handles.axes3,'Band Pass Filter frequency');
end
i want draw a plot
handles.axex5 graph * handles.axex3 graph = handles.axes4
What can I do T,T?
I have no idea....
  5 Kommentare
rollcakes
rollcakes am 4 Dez. 2015
i wnat make filter... TT how I can change two arrays to same
rollcakes
rollcakes am 4 Dez. 2015
Sorry thanks...

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by