Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Select a topic of your interest in the field of science or engineering where you

ID: 3583039 • Letter: S

Question

Select a topic of your interest in the field of science or engineering where you can use mathematics to model a problem and then apply the Matlab to get the results or solve a problem. Possible Topics: Digital Signal Processing Fiber Optics Communication Integrators and Differentiators with Operational Amplifiers (OP AMPS) Passive Filters: High Pass (HP), Low Pass (LP) and Band Pass (BP) Active Filters: High Pass (HP), Low Pass (LP) and Band Pass (BP) Amplifiers and their Frequency Response Oscillators Rectifiers and Voltage Regulators Wave Form Generators using the 555 Timer Any other topic in which mathematics and programming (particularly MATLAB) is used

Explanation / Answer

Answer

Chosen topic Oscillators

Below is Matlab code for the same

function var_out = oscillator(var_in)
% Oscillator m-file for creating figure
% oscillator creates a new oscillator or raises the existing
% singleton*.
%
% H = oscillator returns the handle to a new OSCILLATOR or the handle to
% the existing singleton*.
%
% the function oscillator
%'CALLBACK',hObject,event_data,handles,...) calls the local
% function named CALLBACK in oscillator.m with the given input
% arguments.
%
% oscillator('Property','Value',...) creates a new oscillator or
% raises the
% existing singleton*. Property value pairs are
% applied to the GUI starting from the left, before
% oscillator_opening_fcn gets called. An
% unrecognized property name or invalid value will make property
% application stop. All inputs are passed to
% oscillator_opening_fcn via var_in.
%


% initialization code starts here
gui_single = 1;
gui_State = struct('gui_name', mfilename, ...
'gui_single', gui_single, ...
'gui_opening_fcn', @oscillator_opening_fcn, ...
'gui_output_fcn', @oscillator_output_fcn, ...
'gui_layout_fcn', [] , ...
'gui_callback', []);
if nargin && ischar(var_in{1})
gui_State.gui_Callback = str2func(var_in{1});
end

if nargout
[var_out{1:nargout}] = gui_mainfcn(gui_State, var_in{:});
else
gui_mainfcn(gui_State, var_in{:});
end
end % function end
% initialization code ends here


% --- this part executes just before oscillator is made visible.
function oscillator_opening_fcn(hObject, event_data, handles, var_in)
% hObject : it is a handle to figure
% event_data : this is reserved - to be defined
% handles : it is a structure with handles and user data
% var_in : this is command line arguments to oscillator


% this function update handles structure
guidata(hObject, handles);

% uiwait makes the oscillator wait for user response
% uiwait(handles.figure1);
% ??? slider1_Callback(hObject, eventdata, handles)
% first screen
end % function end

% --- this function give outputs to the command line.
function var_out = oscillator_output_fcn(hObject, event_data, handles)
% var_out : it is a cell array for returning output args
% hObject : it is a handle to figure
% eventdata : reserved - to be defined in a future
% handles : it is a structure with handles and user data (see GUIDATA)

% Fetch default command line output from handles structure
var_out{1} = handles.output;
end
% function ends here

% --- this executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, event_data, handles)
% hObject : it is a handle to pushbutton1 (see GCBO)
% eventdata : it is reserved - to be defined in a future
% handles : it is a structure with handles and user dataclose end
% function end

% --- this executes on slider movement.
function slider1_Callback(hObject, event_data, handles)

% get(hObject,'Value') :this function returns position of slider
% get(hObject,'Min') and get(hObject,'Max') these functions are
% to determine range of slider
beta=get(hObject,'Value')
set(handles.edit1,'String',['beta=',num2str(beta)]);
t0=0; t2=12*pi; % tspan=[t0,t2]
x0= [1.5 0];
[t,x]=nested_ode([t0,t2], x0,beta,handles);
plot(handles.axes1,t,x) % (t,x)
plot(handles.axes2,x(:,1),x(:,2))
title(handles.axes1,'Rwnanie d^2x/dt^2 +eta*dx/dt +x =0, x(0)=1.5, dx/dt(0)=0')
title(handles.axes2,'Wykres fazowy: dx/dt = f(x)')
ylabel(handles.axes2,'dx/dt')
end
% function end here

% --- this function executes during object creation, after
% setting all properties.
function slider1_CreateFcn(hObject, event_data, handles)

% slider controls usually have a light gray background.

if isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor',[.9 .9 .9]);
end
end
% function ends here

function edit1_Callback(hObject, event_data, handles)

% get(hObject,'String') returns contents of edit1 as text
% str2double(get(hObject,'String')) returns contents of edit1 as a double
end % function end

% --- Executes during object creation, after setting all properties.
function edit1_CreateFcn(hObject, event_data, handles)

% edit controls usually have a white background on Windows.

if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
end
% function ends here

function [t,x]=nested_ode(tspan, x0,beta,handles);

[t,x] = ode23 (@mech_ode, tspan , x0); %Runge-Kutta
txt='in nested_ode(tspan, x0,beta);'
beta=get(handles.slider1,'Value')

function xdot=mech_ode(t,x); %nested in..

xdot=zeros(2,1);
xdot(1)=x(2); % x(1)= x x(2)= dx/dt
xdot(2)= -1*x(1) -beta*x(2);
end % nested function end
end % nested function end

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote