help create a positive sin wave
10 次查看(过去 30 天)
显示 更早的评论
Hey! need help creating a positive sin wave
2 个评论
John D'Errico
2022-10-6
A positive sine wave is one who always thinks of the glass as being half full. Of course. ;-)
My guess is Star has the answer, by translating the curve up by a constant. Only a guess though.
回答(2 个)
Star Strider
2022-10-5
Perhaps —
syms t
positive_sine = sin(2*pi*t) + 1
figure
fplot(positive_sine, [0 5])
grid
ylim([-1 3])
hold on
yline(0,':k', 'LineWidth',1.5)
hold off
Sam Chak
2022-10-6
Sounds intriguing. Are you looking for the half-wave rectified sine wave?
x = -2:0.01:2;
y1 = sin(pi*x); % full sine wave
y2 = sin(pi*x).*heaviside(sin(pi*x)); % half-wave rectified sine wave
plot(x, y1, '--'), hold on,
plot(x, y2, 'linewidth', 1.5), grid on, ylim([-1.5 1.5])
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!