add frequency scale for mesh
1 次查看(过去 30 天)
显示 更早的评论
I want to display the frequency scale ( 0:1:10 ) on y-axis for the following code:
x=peaks;
f=10; % freq
fval=0:1:f;
mesh(x)
set(gca,'Ydir','reverse')
ylabel('freq. Hz')
xlabel('Samples')
zlabel('Amp.')
0 个评论
采纳的回答
Star Strider
2016-5-23
This works:
x=peaks;
f=10; % freq
fval=0:1:f;
mesh(x)
set(gca,'Ydir','reverse')
ylabel('freq. Hz')
xlabel('Samples')
zlabel('Amp.')
yt = get(gca,'YLim'); % Get Y-Limits Values
dyt = 0:10; % Desired Y-Tick Values
set(gca, 'YTick',linspace(min(yt),max(yt),length(dyt)), 'YTickLabel', dyt) % Set New Labels
4 个评论
Star Strider
2016-5-23
My pleasure. (Sorry, had to be away for a bit running errands. Life intrudes.)
You ‘xv’ assignment will work as you wrote it, and will do what you want in the meshgrid call:
xv = linspace(0, 20, size(x,2));
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Get Started with Simulink 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!