combine result of fdatool with GUI - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

combine result of fdatool with GUI

polo_coinspolo_coins Posts: 2Member
here I build some function inside one of callbacks, inside of it I enter filter design ,result of fdatool and combine it with GUI otions ,but it doesn't work

function Hd = LP1

Am=str2num( get(handles.edit5,'String') );
Fm=str2num( get(handles.edit4,'String') );
Phase=str2num( get(handles.edit6,'String') );
time=str2num( get(handles.edit3,'String') );
t=linspace(0,time,time*100);
Ac=str2num( get(handles.edit2,'String') );
Fc=str2num( get(handles.edit1,'String') );
axes(handles.axes3)

St=Ac*(1+Am*cos(2*pi*Fm*t+Phase)).*cos(2*pi*Fc*t);
% create some white noise
r=randn(1,length(St));
St_N=St+r; % add noise to signal



%LP1 Returns a discrete-time filter object.

%
% M-File generated by MATLAB(R) 7.6 and the Signal Processing Toolbox 6.9.
%
% Generated on: 25-Mar-2011 10:30:25
%

% Butterworth Lowpass filter designed using FDESIGN.LOWPASS.

% All frequency values are in Hz.

Fpass =str2num( get(handles.edit5,'String') ); % Passband Frequency
Fstop = str2num( get(handles.edit5,'String') )+200; % Stopband Frequency
Fs=Fstop*2.5; % Sampling Frequency

Apass = 1; % Passband Ripple (dB)
Astop = 1.5; % Stopband Attenuation (dB)
match = 'stopband'; % Band to match exactly

% Construct an FDESIGN object and call its BUTTER method.
h = fdesign.lowpass(Fpass, Fstop, Apass, Astop, Fs);
Hd = design(h, 'butter', 'MatchExactly', match);
axes(handles.axes3)
Clean_St_N=filter(St_n,Hd);

plot(t, Clean_St_N)
guidata(hObject,handles);[code][code][/code][/code]
Sign In or Register to comment.