How to scale the x axis ?

4 ビュー (過去 30 日間)
Husnain Ahmed
Husnain Ahmed 2018 年 8 月 31 日
I have two plots from the same sensors. One plot is from target computre and one plot is from my PC. I want to scale the x-axis in such a way that they both look same. Please guide me. Thanks.
  4 件のコメント
Husnain Ahmed
Husnain Ahmed 2018 年 8 月 31 日
plot(Time_vector,cyl_pos/1000) %Data from Target PC xlim([0 25]) hold on plot(pos.time/100,pos.signals.values) %Data from my PC
Saskia van der Peet
Saskia van der Peet 2020 年 7 月 29 日
Thank you! This helped me a lot!

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

回答 (2 件)

Star Strider
Star Strider 2018 年 8 月 31 日
I am not certain what you want to do.
If you want to actually synchronize the signals, consider using the alignsignals (link) function, that I believe was introduced in R2016b. Another option is the dtw (link) ‘dynamic time warping’ function, introduced in R2016a.

Jim Riggs
Jim Riggs 2018 年 8 月 31 日
編集済み: Jim Riggs 2018 年 8 月 31 日
First, you need to get the handle to the current axes:
h=gca;
This gives the handle to the current plot axes. Now you can modify the properties of the axes. To set the X axis limits use:
set (h,'Xlim',[xmin,xmax]);
One good way to keep track of plot handles is to assign them when you make the plot:
h1=plot(...);
...
...
h2=plot(...);
now you can manipulate the different plots:
set(h1,...);
set(h2,...);
  2 件のコメント
Husnain Ahmed
Husnain Ahmed 2018 年 8 月 31 日
Can you please tell me what should i write in h1=plot(. . .); ? Matlab gives me Invalid use of operator error. When i give some value
Jim Riggs
Jim Riggs 2018 年 8 月 31 日
That is your plot command when you create the plot axes, e.g.
h=plot(Time_vector,cyl_pos/1000);

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by