Why when we try to represent a sinus function we use a cosinus expression some times and cosinus another times like the case in matlab?

2 views (last 30 days)
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.

Accepted Answer

Jos (10584)
Jos (10584) on 7 May 2015
Both a cosine and a sine are sinusoids, but one is shifted in phase compared to the other
cos(x) = sin(x + (pi/2))

More Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!