Main Page | Report this Page
 
   
Science Forum Index  »  Mathematics Forum  »  matlab gui
Page 1 of 1    
Author Message
tahira
Posted: Mon Apr 28, 2008 7:10 pm
Guest
i have problem in this code!

function pushbutton1_Callback(hObject, eventdata, handles)

% this code is reading a .wav file
handles.pushbutton1=wavread('test');
plot(handles.axes1,handles.pushbutton1)
handles=handles.pushbutton1;
guidata(hObject,handles)

function popupmenu1_Callback(hObject, eventdata, handles)

%these are popup menu items selection and i am getting coefficiets and save them in handles.popupmenu1
val=get(hObject,'Value');
switch val
case 1
handles.popupmenu1=butter(6,0.3,'low');
case 2
handles.popupmenu1=cheby1(9,[0.3 0.6],'low');
case 3
handles.popupmenu1=fir1(9,0.25,'low');
end
handles=handles.popupmenu1;
guidata(hObject,handles);

%now i have to filter the signal by pressin a push button

function pushbutton2_Callback(hObject, eventdata, handles)

y=filter(handles.popupmenu1,1,handles.pushbutton1);
plot(handles.axes2,y)

this shd plot the filterd signal but i have got these errors!!!!!!

??? Error using ==> cheby1
Wn must be a one or two element vector.

Error in ==> <a href="error:C:\MATLAB7\work\bis.m,113,1">bis>popupmenu1_Callback at 113</a>
handles.popupmenu1=cheby1(9,[0.3 0.6],'low');

Error in ==> <a href="error:C:\MATLAB7\toolbox\matlab\uitools\gui_mainfcn.m,75,1">gui_mainfcn at 75</a>
feval(varargin{:});

Error in ==> <a href="error:C:\MATLAB7\work\bis.m,45,1">bis at 45</a>
gui_mainfcn(gui_State, varargin{:});

??? Error while evaluating uicontrol Callback.

??? Attempt to reference field of non-structure array.

Error in ==> <a href="error:C:\MATLAB7\work\bis.m,96,1">bis>pushbutton2_Callback at 96</a>
y=filter(handles.popupmenu1,1,handles.pushbutton1);

Error in ==> <a href="error:C:\MATLAB7\toolbox\matlab\uitools\gui_mainfcn.m,75,1">gui_mainfcn at 75</a>
feval(varargin{:});

Error in ==> <a href="error:C:\MATLAB7\work\bis.m,45,1">bis at 45</a>
gui_mainfcn(gui_State, varargin{:});

??? Error while evaluating uicontrol Callback.

plz reply soon
Gib Bogle
Posted: Tue Apr 29, 2008 2:40 am
Guest
tahira wrote:
Quote:
i have problem in this code!

function pushbutton1_Callback(hObject, eventdata, handles)

% this code is reading a .wav file
handles.pushbutton1=wavread('test');
plot(handles.axes1,handles.pushbutton1)
handles=handles.pushbutton1;
guidata(hObject,handles)

function popupmenu1_Callback(hObject, eventdata, handles)

%these are popup menu items selection and i am getting coefficiets and save them in handles.popupmenu1
val=get(hObject,'Value');
switch val
case 1
handles.popupmenu1=butter(6,0.3,'low');
case 2
handles.popupmenu1=cheby1(9,[0.3 0.6],'low');
case 3
handles.popupmenu1=fir1(9,0.25,'low');
end
handles=handles.popupmenu1;
guidata(hObject,handles);

%now i have to filter the signal by pressin a push button

function pushbutton2_Callback(hObject, eventdata, handles)

y=filter(handles.popupmenu1,1,handles.pushbutton1);
plot(handles.axes2,y)

this shd plot the filterd signal but i have got these errors!!!!!!

??? Error using ==> cheby1
Wn must be a one or two element vector.

Error in ==> <a href="error:C:\MATLAB7\work\bis.m,113,1">bis>popupmenu1_Callback at 113</a
handles.popupmenu1=cheby1(9,[0.3 0.6],'low');

Error in ==> <a href="error:C:\MATLAB7\toolbox\matlab\uitools\gui_mainfcn.m,75,1">gui_mainfcn at 75</a
feval(varargin{:});

Error in ==> <a href="error:C:\MATLAB7\work\bis.m,45,1">bis at 45</a
gui_mainfcn(gui_State, varargin{:});

??? Error while evaluating uicontrol Callback.

??? Attempt to reference field of non-structure array.

Error in ==> <a href="error:C:\MATLAB7\work\bis.m,96,1">bis>pushbutton2_Callback at 96</a
y=filter(handles.popupmenu1,1,handles.pushbutton1);

Error in ==> <a href="error:C:\MATLAB7\toolbox\matlab\uitools\gui_mainfcn.m,75,1">gui_mainfcn at 75</a
feval(varargin{:});

Error in ==> <a href="error:C:\MATLAB7\work\bis.m,45,1">bis at 45</a
gui_mainfcn(gui_State, varargin{:});

??? Error while evaluating uicontrol Callback.

plz reply soon

Try a Matlab newsgroup. This has nothing to do with mathematics.
David Bernier
Posted: Tue Apr 29, 2008 2:56 am
Guest
tahira wrote:
Quote:
i have problem in this code!

function pushbutton1_Callback(hObject, eventdata, handles)

% this code is reading a .wav file
handles.pushbutton1=wavread('test');
plot(handles.axes1,handles.pushbutton1)
handles=handles.pushbutton1;
guidata(hObject,handles)

function popupmenu1_Callback(hObject, eventdata, handles)

%these are popup menu items selection and i am getting coefficiets and save them in handles.popupmenu1
val=get(hObject,'Value');
switch val
case 1
handles.popupmenu1=butter(6,0.3,'low');
case 2
handles.popupmenu1=cheby1(9,[0.3 0.6],'low');

If you have an order 9 Chebychev Type I _lowpass_ filter,
wouldn't you specify one number, say '0.6'
rather than two numbers as: [0.3 0.6], which seems to me more
typical of a bandstop or bandpass filter?

There are examples here:

<
http://www.mathworks.com/access/helpdesk/help/toolbox/signal/index.html?/access/helpdesk/help/toolbox/signal/cheby1.html
Quote:


Extract:
<< n = 6;
r = 0.1;
Wn = ([2.5e6 29e6]/500e6);
ftype = 'bandpass';

% Transfer Function design
[b,a] = cheby1(n,r,Wn,ftype);
h1=dfilt.df2(b,a); % This is an unstable filter. >>

----

In your:
cheby1(9,[0.3 0.6],'low');

n = 9, Wn = [0.3 0.6], ftype = 'low' and r =???

David Bernier



Quote:
case 3
handles.popupmenu1=fir1(9,0.25,'low');
end
handles=handles.popupmenu1;
guidata(hObject,handles);

%now i have to filter the signal by pressin a push button

function pushbutton2_Callback(hObject, eventdata, handles)

y=filter(handles.popupmenu1,1,handles.pushbutton1);
plot(handles.axes2,y)

this shd plot the filterd signal but i have got these errors!!!!!!

??? Error using ==> cheby1
Wn must be a one or two element vector.

Error in ==> <a href="error:C:\MATLAB7\work\bis.m,113,1">bis>popupmenu1_Callback at 113</a
handles.popupmenu1=cheby1(9,[0.3 0.6],'low');

Error in ==> <a href="error:C:\MATLAB7\toolbox\matlab\uitools\gui_mainfcn.m,75,1">gui_mainfcn at 75</a
feval(varargin{:});

Error in ==> <a href="error:C:\MATLAB7\work\bis.m,45,1">bis at 45</a
gui_mainfcn(gui_State, varargin{:});

??? Error while evaluating uicontrol Callback.

??? Attempt to reference field of non-structure array.

Error in ==> <a href="error:C:\MATLAB7\work\bis.m,96,1">bis>pushbutton2_Callback at 96</a
y=filter(handles.popupmenu1,1,handles.pushbutton1);

Error in ==> <a href="error:C:\MATLAB7\toolbox\matlab\uitools\gui_mainfcn.m,75,1">gui_mainfcn at 75</a
feval(varargin{:});

Error in ==> <a href="error:C:\MATLAB7\work\bis.m,45,1">bis at 45</a
gui_mainfcn(gui_State, varargin{:});

??? Error while evaluating uicontrol Callback.

plz reply soon
 
Page 1 of 1       All times are GMT - 5 Hours
The time now is Mon Oct 06, 2008 11:50 am