# Simulink - Multiplication of Two Sine Signals (i couldn't understand the logic)

14 views (last 30 days)

Show older comments

Hi, while I was doing some practises on Simulink to learn it better on my own, I have stuck and could not find the reason behind one of my self questions:

You can right click and download the pictures for a closer look...

Here, first I have created two sine wave and multiplied them with the "product block".

(I adjusted samples per frame for sine waves as "5" for both of them.)

After that here is the sine signal parameters:

Here is the output:

My question is,

How does the value of the signal dimension ( [5x1] ) was created?

I mean which parameter for sine wave dis affect that dimension?

and my second curiosity is,

When change the value “samples per frame” of the one of sine waves, (I adjusted one of them 1 and other one is 5) the output signal has been changed just like that below:

I could not understand that, when I change one the samples per frame as "1" and other one as "5", its period has been changed. However I could not understand the connection between "the samples per frame" how changes the signal output just like that?

Also, as you can see, I guess the width of the graph lines has been got thicker than before. That looks interesting as well. How could that thing become possible only changing the samples per frame just like that?

Finally, I added the simulink file with the .slx extension. You can have a look via running the .slx file on your own as well.

##### 0 Comments

### Accepted Answer

Paul
on 20 Mar 2022

Edited: Paul
on 20 Mar 2022

Question 1: How does the value of the signal dimension ( [5x1] ) was created? I mean which parameter for sine wave dis affect that dimension?

Answer 1: If you turn on Sample Time annotations, it might become clearer. Anyway, the signal dimension is 5 because of the 5 samples per frame. The sample time of the sine wave is 1/1000 seconds/sample. So, at 5 samples/frame, each frame is 5/1000 seconds long. Within a frame, the output of that sine block will have five elements. Over the first frame, the output of the sine block is:

5*sin(2*pi*10*(0:4)/1000)

which you can see if you put a scope on the output of the sine block and zoom in tight from 0 < t < 0.01, for example. After taking the product with the other sine block (also at 5 samples per frame) the output of the product over the first frame is

5*sin(2*pi*10*(0:4)/1000).*5.*sin(2*pi*10*(0:4)/1000)

which again can be seen by zooming in tight on the scope at the output of the product. Same thing happens over the second frame, but with indices 5:9 instead of 0:4.

Question 2: When change the value “samples per frame” of the one of sine waves, (I adjusted one of them 1 and other one is 5) the output signal has been changed just like that below.

When one of the sine blocks is changed to one sample per frame, it becomes a scalar output at a sample time of 1/1000 seconds/sample. But the other sine block is still a 5x1 that is held constant over frame intervals of 5/1000. So the the output of the product is 5 x 1, at a sample time of 0.001. Over the first 0.005 seconds, the output of the product is then

Time = (0:.001:0.004).';

Product = 5*sin(2*pi*10*(0:4)/1000).*5.*sin(2*pi*10*Time);

table(Time,Product)

which again can be seen by zooming on the scope of the product over the first 0.005 seconds.

##### 4 Comments

Paul
on 20 Mar 2022

### More Answers (0)

### See Also

### Categories

### Community Treasure Hunt

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

Start Hunting!