How i can plot anti periodic sine wave in matlab ?

In summary, the conversation is about using MATLAB to plot anti-periodic functions. The origin site provides a code for plotting a triangular aperiodic pulse, but when the same code is used for a sine wave pulse, an error is encountered. The error is due to too many input arguments for the sin function. The person is asking for help in solving this problem.
  • #1
error 401
19
0
i don't know how i can use MATLAB to plot anti periodic fun ..

the origin site give this code for triangular fun:

fs = 10000;
t = -1:1/fs:1;
x1 = tripuls(t,20e-3);
plot(t,x1), xlabel('Time (sec)');ylabel('Amplitude'); title('Triangular Aperiodic Pulse')


but when i use this for sine wave . i have an error (? Error using ==> sin
Too many input arguments.)

so how i can solve this problem ?

thanx in advance
 
Physics news on Phys.org
  • #2
error 401 said:
i don't know how i can use MATLAB to plot anti periodic fun ..

the origin site give this code for triangular fun:

fs = 10000;
t = -1:1/fs:1;
x1 = tripuls(t,20e-3);
plot(t,x1), xlabel('Time (sec)');ylabel('Amplitude'); title('Triangular Aperiodic Pulse')


but when i use this for sine wave . i have an error (? Error using ==> sin
Too many input arguments.)

so how i can solve this problem ?

thanx in advance

Can you post the code that you used for the sine wave pulse?
 
  • #3
the same code but i change tripulse to sin >>

fs = 10000;
t = -1:1/fs:1;

x1 = sin(t,20e-3);
plot(t,x1), xlabel('Time (sec)');ylabel('Amplitude'); title('sin Aperiodic Pulse')
 

Related to How i can plot anti periodic sine wave in matlab ?

1. How do I generate an anti-periodic sine wave in Matlab?

To generate an anti-periodic sine wave in Matlab, you can use the command plot(t, -sin(t)) where t is the time vector. This will plot a sine wave with a period of 2π and an amplitude of 1, but with the wave inverted along the y-axis.

2. How can I change the amplitude of an anti-periodic sine wave in Matlab?

To change the amplitude of an anti-periodic sine wave in Matlab, you can simply multiply the -sin(t) term by a scaling factor. For example, plot(t, -2*sin(t)) will give you a sine wave with an amplitude of 2.

3. Can I plot multiple anti-periodic sine waves in one graph using Matlab?

Yes, you can plot multiple anti-periodic sine waves in one graph using Matlab. Simply use the hold on command before plotting each wave, and then use hold off when you are finished to prevent any additional plots from being added to the graph.

4. How do I change the frequency of an anti-periodic sine wave in Matlab?

To change the frequency of an anti-periodic sine wave in Matlab, you can use the expression plot(t, -sin(n*t)) where n is the desired frequency. The larger the value of n, the higher the frequency of the wave will be.

5. Is it possible to add a phase shift to an anti-periodic sine wave in Matlab?

Yes, you can add a phase shift to an anti-periodic sine wave in Matlab by using the expression plot(t, -sin(t + phi)) where phi is the desired phase shift angle in radians. This will shift the entire wave to the left or right on the x-axis, depending on the positive or negative value of phi.

Similar threads

  • Engineering and Comp Sci Homework Help
Replies
0
Views
150
  • Engineering and Comp Sci Homework Help
Replies
2
Views
867
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
162
Replies
139
Views
4K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
990
Replies
7
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
1K
  • Engineering and Comp Sci Homework Help
Replies
3
Views
2K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
3K
Back
Top