How i can plot anti periodic sine wave in matlab ?

AI Thread Summary
To plot an anti-periodic sine wave in MATLAB, the user attempted to modify a triangular pulse code but encountered an error due to incorrect function usage. The original code used the `tripuls` function, which was correctly applied, but when substituting it with `sin`, the user mistakenly included too many input arguments. The correct approach is to use `x1 = sin(2*pi*f*t)` where `f` is the frequency, ensuring only one argument is passed to the `sin` function. Users are encouraged to adjust their sine wave code accordingly to avoid errors and successfully plot the desired wave.
error 401
Messages
19
Reaction score
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
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?
 
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')
 

Similar threads

Replies
1
Views
2K
Replies
8
Views
2K
Replies
0
Views
849
Replies
1
Views
2K
Replies
3
Views
2K
Replies
34
Views
12K
Back
Top