0% found this document useful (0 votes)
32 views2 pages

Simulation Part Exp 1

The document describes using MATLAB code to simulate and plot sinusoidal waves. It shows how to create a single sinusoidal wave, add two waves together and plot the result, add more waves in a manual way, and then use a for loop to programmatically add many waves together and plot the cumulative wave.

Uploaded by

Mohamd barca
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views2 pages

Simulation Part Exp 1

The document describes using MATLAB code to simulate and plot sinusoidal waves. It shows how to create a single sinusoidal wave, add two waves together and plot the result, add more waves in a manual way, and then use a for loop to programmatically add many waves together and plot the cumulative wave.

Uploaded by

Mohamd barca
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Simulation part:

1. Creating sinusoidal wave using the following commands:


x=-pi:0.01:pi;
y=sin (x);
plot (y);

2. Adding two waves and plotting the results:


x=-pi:0.01:pi;
y1=sin (x);
y2=(1/3)*sin(3*x);
y=y1+y2;
plot (y);
3. Repeating step 2 and adding more waves:
x=-pi:0.01:pi;
y1=sin(x);
y2=(1/3)*sin(3*x);
y3=(1/5)*sin(5*x);
y4=(1/7)*sin(7*x);
y5=(1/9)*sin(9*x);
y=y1+y2+y3+y4+y5;
plot (y);

4. Using for loop to add more waves:


x=-pi:0.01:pi;
y=sin(x);
m=100;
for i=3:2:m
y=y+(1/i)*sin(i*x);
end
plot (y)

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy