Matlab

Moderators: None (Apply to moderate this forum)
Number of threads: 1471
Number of posts: 2147

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
combine result of fdatool with GUI Posted by polo_coins on 25 Mar 2011 at 10:19 AM
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);




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.