we asked in an exercise to create a sinusoidal signal of 0.8 seconds with an amplitude of 1 and frequency equal to 100 Hz sampled to 1000 Hz , but in the answer i found:
A=1;fs=100;fe=1000; te=1/fe; t=0:te:0.8; s=A*cos(2*pi*fs*t); plot(s);
And in another exercise: write a script for a sinusoidal signal amplitude 1 and 200KHz frequency, over a period N = 64, sampled at 150 KHz.the answer was :
%Signal
fs=200;N=64;
ts=1/fs;
A=1;
subplot(211);
t=0:0.00001:N*ts;
x=sin(2*pi*t*fs);
plot(t,x);
title('signal sinusoidal');
%Echantillonnage
Fe=input('Fe=');
te=1/Fe;
t1=0:te:N*te;
xe=sin(2*pi*t1*fs);
subplot(212);
stem(t1,xe);
I'm so confused ,when to put a sin and when to put a cosin ;My question is that why they puted a cosin instead of a sin is there is some kind of rule behind it ; and thanks in advance.
Best Answer