4 05 2017
VTIY ODEV YANITLARI (25/04/2017)
function varargout = Fourier1(varargin)
% FOURIER1 MATLAB code for Fourier1.fig
% Begin initialization code – DO NOT EDIT
gui_Singleton = 1;
gui_State = struct(‘gui_Name’, mfilename, …
‘gui_Singleton’, gui_Singleton, …
‘gui_OpeningFcn’, @Fourier1_OpeningFcn, …
‘gui_OutputFcn’, @Fourier1_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
% End initialization code – DO NOT EDIT
% — Executes just before Fourier1 is made visible.
function Fourier1_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to Fourier1 (see VARARGIN)
% Choose default command line output for Fourier1
handles.output = hObject;
% Update handles structure
guidata(hObject, handles);
% UIWAIT makes Fourier1 wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% — Outputs from this function are returned to the command line.
function varargout = Fourier1_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Get default command line output from handles structure
varargout{1} = handles.output;
% — Executes on selection change in popFrekans1.
function popFrekans1_Callback(hObject, eventdata, handles)
% hObject handle to popFrekans1 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,’String’)) returns popFrekans1 contents as cell array
% contents{get(hObject,’Value’)} returns selected item from popFrekans1
% — Executes during object creation, after setting all properties.
function popFrekans1_CreateFcn(hObject, eventdata, handles)
% hObject handle to popFrekans1 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
% — Executes on selection change in popPeriyotSay.
function popPeriyotSay_Callback(hObject, eventdata, handles)
% hObject handle to popPeriyotSay (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,’String’)) returns popPeriyotSay contents as cell array
% contents{get(hObject,’Value’)} returns selected item from popPeriyotSay
% — Executes during object creation, after setting all properties.
function popPeriyotSay_CreateFcn(hObject, eventdata, handles)
% hObject handle to popPeriyotSay (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
% — Executes on button press in btnSinyalOlustur.
function btnSinyalOlustur_Callback(hObject, eventdata, handles)
% hObject handle to btnSinyalOlustur (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
clear fs f;
cla;
axes(handles.axes1);
SinyalFrekans1=get(handles.popFrekans1,’Value’);
switch SinyalFrekans1
case 1
SinyalFrekans1=5;
case 2
SinyalFrekans1=25;
case 3
SinyalFrekans1=50;
end
SinyalFrekans2=get(handles.popFrekans2,’Value’);
switch SinyalFrekans2
case 1
SinyalFrekans2=5;
case 2
SinyalFrekans2=25;
case 3
SinyalFrekans2=50′;
end
Periyot=get(handles.popPeriyotSay,’Value’);
switch Periyot
case 1
Periyot=3;
case 2
Periyot=5;
case 3
Periyot=10;
end
f1=SinyalFrekans1; % 5 hz sinyalin frekansı, periyot 1/5=0.2 saniye.
f2=SinyalFrekans2;
A=1; % genlik 1
fs=f1*20; % 100 hz. örnekleme frekansını 20 kat fazla aldık. nyquist’e göre 2 kat olsa yeterli.
ts=1/fs; % örnekleme periyodu. 0.01 saniye Yani kaç sn’de bir örnek alacak.
t=0:ts:Periyot/f1; % 0:0.01:2 kaç periyot boyunca örnekleme yapıyoruz. Burada 10*t yani 10/f kadar.
x=A*sin(2*pi*f1*t); % sinus dalgasinda belirtilen sürede örnek al
y=A*sin(2*pi*f2*t);
handles.z=x+y;
handles.fs=fs;
plot(t,handles.z);
guidata(hObject, handles);
% — Executes on button press in btnFourierDonusumu.
function btnFourierDonusumu_Callback(hObject, eventdata, handles)
% hObject handle to btnFourierDonusumu (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
axes(handles.axes2);
fft0=fft(handles.z);
fft1=abs(fft0);
fv=0:(handles.fs/(length(handles.z)-1)):handles.fs;
plot(fv,fft1);
% — Executes on selection change in popFrekans2.
function popFrekans2_Callback(hObject, eventdata, handles)
% hObject handle to popFrekans2 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = cellstr(get(hObject,’String’)) returns popFrekans2 contents as cell array
% contents{get(hObject,’Value’)} returns selected item from popFrekans2
% — Executes during object creation, after setting all properties.
function popFrekans2_CreateFcn(hObject, eventdata, handles)
% hObject handle to popFrekans2 (see GCBO)
% eventdata reserved – to be defined in a future version of MATLAB
% handles empty – handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,’BackgroundColor’), get(0,’defaultUicontrolBackgroundColor’))
set(hObject,’BackgroundColor’,’white’);
end
Bulanık Mantık ile Kontrol Final Projesi Açıklamaları VTIY Sinyal Toplamları Fourier Dönüşüm ve Geri Kazanma