# matlab words no help needed

3 views (last 30 days)

Show older comments

##### 3 Comments

Stephen23
on 16 May 2021

Edited: Stephen23
on 16 May 2021

Original question by Tyler Daines retrieved from Google Cache (unfortunately their deleted comments are not included):

Trying to plot a sine+sine function but not getting a smooth curve

### Answers (2)

DGM
on 11 May 2021

What you're looking at isn't meaningful. It's all just rounding error. You're essentially doing this:

y = sin(x) - sin(x);

I'm guessing there's some phase component that's not defined right yet, but I can't really guess at what you need it to be.

f = 2;

A = 1;

v = 1;

L = 1;

l = v/f;

B = (2*pi)/l;

w = 2*pi*f;

t = 0;

x = 0:0.0001:L;

z1 = A*sin(B*x - w*t);

z2 = A*sin(B*(L-x) - w*t);

y = z1+z2;

plot(x,z2); hold on

plot(x,z1);

For the future, please just paste your code using the code formatting tools. I had to retype all that and deal with the sub-pixel ambiguity differentiating the character '1' and 'l'.

##### 2 Comments

RAHUL MAURYA
on 12 May 2021

clear all;

clc;

f = 2;

A = 1;

v = 1;

L = 1*(180/(pi));

l = v/f;

B = ((2*pi)/l)*(180/pi);

w = 2*pi*f;

t = 0;

x=0:0.0001:L;

z1 = (A*sind(B*x - w*t));

z2 = A*sind(B*(L-x) - w*t);

y=(z1+z2);

subplot(3,1,1);

plot(x,z1)

title('X,Z1')

axis([0 10 -1 1])

subplot(3,1,2);

plot(x,z2)

title('X,Z2')

axis([0 10 -1 1])

subplot(3,1,3);

plot(x,y)

title('X,Z1+Z2')

axis([0 10 -2 2])

Convert B and L in radian to degree.

### See Also

### Categories

### Community Treasure Hunt

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

Start Hunting!