フィルターのクリア

how to plot 3D figure like this?

4 ビュー (過去 30 日間)
Daniel Niu
Daniel Niu 2022 年 11 月 30 日
コメント済み: Star Strider 2022 年 11 月 30 日
Dear friends,
How to plot 3D figure like this considering square wave =sin(x)+1/3sin(3x)+1/5sin(5x)+...
Your help would be highly appreciated.
Best regards

採用された回答

Star Strider
Star Strider 2022 年 11 月 30 日
Try something like this —
Fs = 250;
L = 100;
f = 1.26;
t = linspace(0, L-1, L)/Fs;
s = sin([0 (1:2:20)].'*2*pi*t*f)./[1 (1:2:20)].';
ssm = sum(s);
figure
plot(t, s, t, ssm)
figure
hr = ribbon(t,[ssm; s].', 0.1);
colormap(turbo)
Another option is plot3. The waterfall plot would likely not work well here.
I leave the details (and any other improvements) to you.
.
  3 件のコメント
Daniel Niu
Daniel Niu 2022 年 11 月 30 日
By the way, what is meaning of .' in hr = ribbon(t,[ssm; s].', 0.1)?
Thank you
Star Strider
Star Strider 2022 年 11 月 30 日
My pleasure!
It seems the plots has some width. How to plot them looks like lines?
The third argument to ribbon is ribbon width. Reduce it to whatever value you need to to get the result you want.
By the way, what is meaning of .' in hr = ribbon(t,[ssm; s].', 0.1)?
It does a simple transpose, .' of the matrix. (A complex conjugate transpose is ctranspose, and uses a single quote(') as its operator).
.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Data Workflows についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by