How can I change a square wave into a sign wave with the graph provided?

1 回表示 (過去 30 日間)
Nicholas
Nicholas 2022 年 9 月 19 日
回答済み: Steve Eddins 2022 年 9 月 19 日
Hello,
Im trying to turn this square graph into a sign wave. Any thoughts on how I would go about doing that? The graph provided is how it looks now but it needs to be more of a sign wave.
Here is the code Ive made so far:
frequency = 11.4;
phase = 50;
amplitude = 1;
[X,Y]=meshgrid(0:0.001:1,0:0.001:1);
Z = amplitude*sign(sin((2*3.1415*frequency.*X)+(phase)));
surf(X,Y,Z)
shading interp
view(0,90)
colormap gray
axis off
axis square

回答 (1 件)

Steve Eddins
Steve Eddins 2022 年 9 月 19 日
Try removing the call to the sign function.

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by