Plot strings on y axis

7 ビュー (過去 30 日間)
Takis Akis
Takis Akis 2022 年 6 月 6 日
回答済み: dpb 2022 年 6 月 6 日
この 質問 は dpb さんによってフラグが設定されました
Cheers, I have a quantized signal that I want to encode and then plot. For example, if I have L = 8 levels of quantization (so I can use 2^3 = 8, so 3 bits for every level) , I want to be able to make a mapping of this sort: if I am at the first level the encoded code is "000", the second level is "001" and so one, up to level 8 where the output is "111". Then I want to be able to plot that. An example I have is here:
Here the signal I am encoding is a simple cosine sampled from 0 to 1 with step 0.01.
What I am thinking is that I should plot the strings on the "y-axis", but I don't know how I go about this. Any help? Thanks

回答 (2 件)

Voss
Voss 2022 年 6 月 6 日
plot((1:15)/15,[7:-1:0 1:7]) % some plot
set(gca(),'YTick',0:7,'YTickLabels',dec2bin(0:7,3)) % set the yticks and labels

dpb
dpb 2022 年 6 月 6 日
This is the identical Q? including the example answered at <how-to-plot-each-row-of-a-mxn-array-as-one-value?>
Apparently, a homework problem somewhere...

カテゴリ

Help Center および File ExchangeAxis Labels についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by