Kami_Munchkins
New Coder
I want it to set variable g depending on whether it is a sin, sawtooth or cos. I though i should set it dependent on the input on variable x, however i can't seem to get it to work... I am very new to coding, self taught and would appreciate any help
Code:
clear all;
close all;
clc;
A = 3;
phi = 90;
f1 = 0.5;
SampleRate = 40000;
t1=-2*pi:pi/SampleRate:2*pi;
x = input('name');
if x == sin
g = A*sin(2*pi*f1*t1+phi);
elseif x == cos;
g = A*cos(2*pi*f1*t1+phi);
elseif x == sawtooth
g = (-(2*A)/pi)*(atan(cot((pi)/(1/f1)*t)))
end