%Daniel Lewis
%Lab 4
%Feb 18, 2007
clear
clc
TrigFuncMenu
FuncType = input('Which type would you like to graph?\n');
disp ('This program is to be used to show affects of chainging variables in trig functions.')
disp ('The two variables we will alter are A, affecting amplitude, and B, affecting period.')
AmpVar = input('Please enter a value for A.\n');
PerVar = input('Please enter a value for B.\n');
syms('X')
if FuncType == 1
FuncTypeStr = 'sin';
Y = AmpVar*sin(PerVar*X)
elseif FuncType == 2
FuncTypeStr = 'cos';
Y = AmpVar*cos(PerVar*X)
else
FuncTypeStr = 'tan';
Y = AmpVar*tan(PerVar*X);
end
if FuncType ==3
ezplot(Y, [0,pi/PerVar])
grid on
xlabel('This is the period')
ylabel('This shows the amplitude')
Amplitude = AmpVar;
Period = PerVar;
else
ezplot(Y, [0,2*pi/PerVar])
grid on
xlabel('This is the period')
ylabel('This shows the amplitude')
Amplitude = AmpVar;
Period = 2/PerVar;
end
if Period ~= 1
if Amplitude ~= 1
disp(['The function you graphed is ',num2str(Amplitude),FuncTypeStr,'(',num2str(PerVar),'x).'])
disp(['The amplitude is ',num2str(Amplitude),' and the period is ',num2str(Period),'pi.'])
else Amplitude == 1
disp(['The function you graphed is ',FuncTypeStr,'(',num2str(PerVar),'x).'])
disp(['The amplitude is ',num2str(Amplitude),' and the period is ',num2str(Period),' pi.'])
end
elseif Amplitude ~= 1
disp(['The function you graphed is ',num2str(Amplitude),FuncTypeStr,'(x).'])
disp(['The amplitude is ',num2str(Amplitude),' and the period is pi.'])
else
disp(['The function you graphed is ',FuncTypeStr,'(x).'])
disp(['The amplitude is ',num2str(Amplitude),' and the period is pi.'])
end