![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/290177/image.png)
Plot two spectrum plot in one spectrum plot?
2 次查看(过去 30 天)
显示 更早的评论
Hi ,
I have a question regarding plotting of two spectrum plots into one spectrum but resultant plot must be appended after the first plot.
I have saved spectrum as a figure.
I have read many threads all of them are supporimposing or making sub plots.
My query is that how to join one figure plot line with second figure plot line.
I have attached as a reference two figures.
Both figures have same x axis label(0-400) but I want resultant plot must have consistant values like 0 - 800.
0 个评论
采纳的回答
Ameer Hamza
2020-5-4
编辑:Ameer Hamza
2020-5-4
Try this, using the two fig files you shared.
fig1 = openfig('Ichannel0_400_1.fig');
fig2 = openfig('Ichannel_400_1_800.fig');
ax1 = findobj(fig1, 'type', 'axes');
ax2 = findobj(fig2, 'type', 'axes');
l1 = findobj(fig1, 'type', 'line');
l2 = findobj(fig2, 'type', 'line');
l1.XData = [l1.XData l2.XData+l1.XData(end)];
l1.YData = [l1.YData l2.YData];
ax1.XLim = [min(l1.XData) max(l1.XData)];
figure(fig1);
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/290177/image.png)
10 个评论
Ameer Hamza
2020-5-13
If you divide by max value than the gain will be 1 at 0Hz. I think you can just subtract the value of the signal at 0Hz.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!