-1
$\begingroup$

I have a big problem to solve fast but I couldn't find anything about how to do that. I have a vector of amplitudes $1 \times n$, they are simple integers. I want to multiply these amplitudes individually by $\cos(2 \pi f t)$, where the time $t$ is defined as the vector t=0:1/(10*f):1/f in Matlab. I couldn't find any solutions and I need help. Any help will be appreciated, thanks.

$\endgroup$
2
$\begingroup$

Your time $t$ is a vector with multiple values and $\cos(2\pi ft)$ is a function of $t$ which means that $\cos(2 \pi ft)$ will also be a vector that changes with your $t$. To multiply your signal with your amplitude vector the vectors must have the same dimensions. For example:

f = 50; %frequency
amp = 1:11; %amplitude vector 1x11
t=0:1/(10*f):1/f; %time vector 1x11
x = cos(2*pi*f*t); %signal with same dimensions as the time vector
y = amp.*x; %multiplication with .* operator
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.