In MATLAB I can't seem to figure out how to get the dspdata.psd function to display my power spectral density plot in Hz instead of kHz for the x-axis. If anyone knows a solution it would be greatly appreciated, thank you!
Asked
Active
Viewed 1,299 times
2 Answers
1
I'm not familiar with the dspdata.psd
function, but you can directly change it on the figure after you plot it by:
ax = gca();
for i=1:numel(ax.Children)
ax.Children(i).XData = ax.Children(i).XData*1000;
end
ax.XLabel.String = 'Frequency [Hz]';
Note, that I'm using Matlab 2014b - if you are using an older version, you might not have access to ax.Children the same way in that case you can do it like this:
ax = gca();
data = get(ax,'Children');
for i=1:numel(data)
set(data(i),'XData', get(data(i),'XData')*1000);
end
set(get(ax,'XLabel'),'String','Frequency [Hz]');

Tamás Szabó
- 733
- 6
- 9
0
You may change the axis scale from the figure properties(Show Plot Tools and Dock Figure) option. In the X Axis tab, you can modify the X Limits to Hz from KHz.

smyslov
- 1,279
- 1
- 8
- 29