# Multiplication of two variables that has different lengths; (MATLAB coding) [closed]

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.

## closed as off-topic by MBaz, Peter K.♦Dec 3 '17 at 19:39

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "General programming questions are off-topic here, but can be asked on Stack Overflow." – MBaz, Peter K.
If this question can be reworded to fit the rules in the help center, please edit the question.

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