how to multiply two sinewaves of different amplitude and frequency in MATLAB/simulink

 Accepted Answer

t=0:0.01:10
Eqn1=a1*sin(w1*t);
Eqn2=a2*sin(w1*t);
as you might know, Eqn1 and Eqn2 are matrices.
Eqn1.*Eqn2 will multiply each element of Eqn1 matrix to corresponding Element in the Eqn2 matrix. for doing this, length of Eqn1 and Eqn2 should be same.
Eqn1*Eqn2 is the normal matrix multiplication. This will need the inner dimensions of Eqn1 and Eqn2 to be equal. that is
[m1,n1]=size(Eqn1);
[m2,n2]=size(Eqn2);
only if n1 and m2 are equal you can do Eqn1*Eqn2. similarly if n2 and m1 are equal you can do Eqn2*Eqn1.

More Answers (2)

What is the problem if amplitudes an frequencies are different? You can use a simple product block

1 Comment

Naga Sai, what are your inputs, and what are your required outputs? What is there about J Smith's answer that did not work for your situation ?

Sign in to comment.

i need an urgent answer:
Can i multiply one sine wave and one cos wave signal using a product block in simulink? IS the process correct? After that i need to pass it through a low pass filter to attentuate or cut off a certain part of frequency components. I have used the LOW PASS Filter block but the output is coming a sqare wave signal and is distorted. I cant understand why. Can somebody explain?

Products

Asked:

on 5 Nov 2013

Commented:

on 20 May 2017

Community Treasure Hunt

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

Start Hunting!