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.

 채택된 답변

Ameer Hamza
Ameer Hamza 2020년 5월 4일
편집: Ameer Hamza 2020년 5월 4일

0 개 추천

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);

댓글 수: 10

thanks for prompt response;
Dear is it possible to also change some y values of the plot.Means I want to get rid of ambiguos peaks
Ameer Hamza
Ameer Hamza 2020년 5월 4일
Can you mark the peaks on an image which you want to remove?
yes at 400 and 800 .
Something like this?
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 = smoothdata([l1.YData l2.YData]);
ax1.XLim = [min(l1.XData) max(l1.XData)];
figure(fig1);
Thanks Ameer Hamza
Ameer Hamza
Ameer Hamza 2020년 5월 5일
I am glad to be of help.
Hi Ameer,
I want to ask that is there a way to normalize the plot too?
Means values start from zero rather than sum value.
Ameer Hamza
Ameer Hamza 2020년 5월 13일
Can you explain more? Do you want the value of start of the signal to be 0?
Yes Ameer Y axis value must be zero for 0 Hz. Means all value must be divided by max gain(i.e. st 0 hz).
Ameer Hamza
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개)

카테고리

도움말 센터File Exchange에서 Creating, Deleting, and Querying Graphics Objects에 대해 자세히 알아보기

제품

릴리스

R2019b

질문:

2020년 5월 4일

댓글:

2020년 5월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by