![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/683998/image.jpeg)
How to plot this signal on matlab? Bounty
1 回表示 (過去 30 日間)
古いコメントを表示
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/683988/image.png)
0 件のコメント
採用された回答
Simon Chan
2021 年 7 月 14 日
Not sure what is the exact function of the curve and simply assume it to be a cosine function.
x=linspace(-1,1);
y=cos(pi*x/2);
w=1-abs(x);
u=linspace(-6,6,600);
v=[w(51:100),y,w,y,w,y,w(1:50)];
plot(u,v,'Linewidth',2)
xlabel('Time')
ylabel('x(t)')
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/683998/image.jpeg)
0 件のコメント
その他の回答 (1 件)
Yazan
2021 年 7 月 14 日
T = 4; % period
F = 1/4; % fundamental frequency
Fs = 1000; % sampling frequency
t = -6:1/Fs:6-1/Fs; % time vector
x1 = cos(2*pi*F*t); % first signal is cos signal
x1(x1<0) = 0; % set negative part to zero
x2 = sawtooth(2*pi*F*t, 1/2); % second signal is triangular
x2(x2<0) = 0; % set negative part to zero
x3 = x1+x2; % sum of the two signals
f = figure('Units', 'normalized', 'Position', [0.08 0.4 0.77 0.48]);
subplot(1,3,1), plot(t, x1); grid minor
xlabel('Time'); ylabel('Cos signal');
subplot(1,3,2), plot(t, x2); grid minor
xlabel('Time'); ylabel('Triangular signal');
subplot(1,3,3), plot(t, x3); grid minor
xlabel('Time'); ylabel('Composite signal');
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Fourier Analysis and Filtering についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!