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

madhan ravi
madhan ravi 2018년 8월 31일
upload your code
jonas
jonas 2018년 8월 31일
편집: jonas 2018년 8월 31일
There's no way to scale the x-axis so they look the same. You can however manipulate the x-data in various ways. If you want to automate this process, then I'd apply variable translation and scale factors to the x-data of one series and then find the optimal parameters by minimizing the residuals. Perhaps this is a bit overkill.
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일

1 개 추천

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일

0 개 추천

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
That is your plot command when you create the plot axes, e.g.
h=plot(Time_vector,cyl_pos/1000);

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Line Plots에 대해 자세히 알아보기

질문:

2018년 8월 31일

댓글:

2020년 7월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by