How to plot non equally spaced data in an equally spaced fashion and lable Xaxis with the data
1 回表示 (過去 30 日間)
古いコメントを表示
Hi all,
I am trying to plot three variable on the double Y axis, I set "frequency" as X axis; "Tvalue" as left Y axis; "correlation" as right Y axis.I want to plot "correlation" as bar plot,Tvalue as line plot.
figure(1)
[hAxes,hBar,hLine]=plotyy(freq,T,freq,correlation,'bar','plot');%%
set(hLine,'color',[0,0,1],'LineWidth',1,'Marker','o','MarkerSize',2,...
'MarkerFace','y')
set(hAxes(1),'ylim',[-3 6])
set(hAxes(2),'ylim',[0 0.5])
set(hAxes(1),'yTick',[-3:1:6]);
set(hAxes(2),'yTick',[0:0.1:0.5]);
set(gca,'XTick',[0:0.05:1]);
xlabel('Frequency')
ylabel(hAxes(1),'Tvalue')
ylabel(hAxes(2),'correlation')
The problem I am facing is that I cannot plot the data in an equally-spaced plot . This is what I have now:
0 件のコメント
回答 (1 件)
KSSV
2020 年 12 月 3 日
Read about interp1. USe interpolation and make the data even. Let F, T be your column data.
m = length(F) ;
Fi = linspace(min(F),max(F),m) ;
Ti = interp1(F,T,Fi) ;
plot(Fi,Ti)
5 件のコメント
参考
カテゴリ
Help Center および File Exchange で Two y-axis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!