sine wave
1 回表示 (過去 30 日間)
古いコメントを表示
Can any one help me to run this program?
function varargout = simira(varargin)
% - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @simira_OpeningFcn, ...
'gui_OutputFcn', @simira_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
function varargout = simira_OutputFcn(hObject, eventdata, handles)
varargout{1} = handles.output;
% - DO NOT EDIT
% --- Project Opening Function.============================================
function simira_OpeningFcn(hObject, eventdata, handles, varargin)
% Default values
handles.xl=4000;
handles.yl=3000;
handles.Am=3;
handles.Fr=2000;
handles.output = hObject;
guidata(hObject, handles);
% --- X length slider.=====================================================
function slider1_Callback(hObject, eventdata, handles)
handles.xl=get(hObject,'value');
set(handles.text1,'string',strcat('Xlength=',num2str(handles.xl,'%4.f'),'µm'));
guidata(hObject, handles);
[t y A]=simiraFun(handles.xl,handles.yl,handles.Am,handles.Fr);
surf(t,y,A);
shading interp
function slider1_CreateFcn(hObject, eventdata, handles)
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
%==========================================================================
% --- Y length slider.=====================================================
function slider2_Callback(hObject, eventdata, handles)
handles.yl=get(hObject,'value');
set(handles.text2,'string',strcat('Ylength=',num2str(handles.yl,'%4.f'),'µm'));
guidata(hObject, handles);
[t y A]=simiraFun(handles.xl,handles.yl,handles.Am,handles.Fr);
surf(t,y,A);
shading interp
function slider2_CreateFcn(hObject, eventdata, handles)
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
%==========================================================================
% --- Amplitude slider.====================================================
function slider3_Callback(hObject, eventdata, handles)
handles.Am=get(hObject,'value');
set(handles.text3,'string',strcat('Amplitude=',num2str(handles.Am,'%1.f'),'µm'));
guidata(hObject, handles);
[t y A]=simiraFun(handles.xl,handles.yl,handles.Am,handles.Fr);
surf(t,y,A);
shading interp
function slider3_CreateFcn(hObject, eventdata, handles)
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
%==========================================================================
% --- Frequency slider.====================================================
function slider4_Callback(hObject, eventdata, handles)
handles.Fr=get(hObject,'value');
set(handles.text4,'string',strcat('Frequency=',num2str(handles.Fr,'%1.f'),'Hz'));
guidata(hObject, handles);
[t y A]=simiraFun(handles.xl,handles.yl,handles.Am,handles.Fr);
surf(t,y,A);
shading interp
function slider4_CreateFcn(hObject, eventdata, handles)
if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
%==========================================================================
% --- Plot pushbutton.=====================================================
function pushbutton1_Callback(hObject, eventdata, handles)
[t y A]=simiraFun(handles.xl,handles.yl,handles.Am,handles.Fr);
surf(t,y,A);
shading interp
%==========================================================================
% --- Clear pushbutton.====================================================
function pushbutton2_Callback(hObject, eventdata, handles)
cla
%==========================================================================
And this the function
function [t y A]=simiraFun(xl,yl,am,fr)
Fre=fr/1000000;
SFre=4*Fre;
t=0:(1/SFre):xl;
x=am*sin(Fre*t);
A=ones(yl+1 ,1)*x;
y=0:yl;
Any help would be greatly appreciated. Simira
回答 (2 件)
Image Analyst
2012 年 4 月 5 日
Probably not. Because it's a GUIDE program and you supplied only the m-file and not the .fig file so we can't run it. Plus you didn't say why we should, like what kind of strange behavior or error that we should look for and try to fix. So it's unlikely that anyone would want to build a GUI and run your program, when you've given no guidance as to what kind of help you need.
0 件のコメント
simira atraqi
2012 年 4 月 5 日
1 件のコメント
Image Analyst
2012 年 4 月 5 日
This should have been a "comment" to my "Answer" rather than an "Answer" by you.
What ever happened to your .fig file? Did you create this, or did someone else give you only the .fig file and forget to give you their .fig file?
参考
カテゴリ
Help Center および File Exchange で Specifying Target for Graphics Output についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!