フィルターのクリア

Plot two sets of unequal data

1 回表示 (過去 30 日間)
ayat
ayat 2017 年 4 月 4 日
コメント済み: KSSV 2017 年 4 月 5 日
I have the data sets in the attached. I need to plot them all in the same figure, with the first one being x. As you can see, the third column has much lower number of values. I guess I need to somehow have them all interpolated to the empty space between each two values is filled up? Or is there anyway Matlab can do it by some sort of function?
  2 件のコメント
John D'Errico
John D'Errico 2017 年 4 月 4 日
How can we "see"? Have you forgotten to attach something? There are no attachments that you have provided.
ayat
ayat 2017 年 4 月 4 日
編集済み: ayat 2017 年 4 月 4 日
Sorry, I saw the file successfully attached message and thought it was uploaded :D. I added the file.

サインインしてコメントする。

回答 (1 件)

KSSV
KSSV 2017 年 4 月 4 日
編集済み: KSSV 2017 年 4 月 4 日
You can interpolate your data using interp1.
Read about interp1
[num,txt,raw] = xlsread('values.xls') ;
x = num(:,1) ;
y = num(:,2) ;
xi = num(:,3) ;
xi = sort(xi(~isnan(xi))) ;
yi = interp1(x,y,xi) ;
plot(x,y,'r')
hold on
plot(xi,yi,'k')
  2 件のコメント
ayat
ayat 2017 年 4 月 5 日
But this does not plot the third column though. I want the empty spaces between the values in the third columns to be filled up so they are the same number as the other two (2560).
KSSV
KSSV 2017 年 4 月 5 日
What is column 3 actually? It has any connection with column 1 or column 2?

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by