필터 지우기
필터 지우기

how do I find the x-axis value from my yline intercept on my acceleration curve

조회 수: 2 (최근 30일)
I have an acceleration curve and i need to find the 0-60mph (0-26.8224m/s) Stuck on how to get there, currently only have a yline that shows where 26.8224m/s along the y-axis. Please help! Here's my code and a picture of the graph:
figure(6)
P1 = plot(tout,yout(:,1));
xlabel('Time (s)')
ylabel('Velocity (m/s)')
grid on
set(P1,'linewidth',2)
title('Acceleration Curve')
yline(26.8224)
  댓글 수: 2
Dyuman Joshi
Dyuman Joshi 2023년 11월 2일
I believe there's a typo in the problem statment. It should be 0-60m/s
Dyuman Joshi
Dyuman Joshi 2023년 11월 2일
@Sam, what is the relation between velocity and time? Do you have an expression/equation?

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

채택된 답변

Voss
Voss 2023년 11월 1일
% some data:
tout = (0:60).';
yout = 10*log(tout+1);
y_val = 26.8224;
% your plot:
P1 = plot(tout,yout(:,1),'linewidth',2);
xlabel('Time (s)')
ylabel('Velocity (m/s)')
grid on
title('Acceleration Curve')
yline(y_val)
% find the t value where y is y_val:
t0 = interp1(yout(:,1),tout,y_val)
t0 = 13.6259
% plot a vertical red line to that point on the curve:
hold on
plot([t0,t0],[0,y_val],'--r')
  댓글 수: 4
Voss
Voss 2023년 11월 3일
Linear interpolation gives a point on the curve MATLAB plotted. If there's a non-linear function underlying that curve, use an interpolation method suitable to that function in your judgment.
Dyuman Joshi
Dyuman Joshi 2023년 11월 3일
But you chose a non-linear function, then why did you use linear interpolation?
Also, the point obtained by linear interpolation is not correct -
syms t
eqn = 10*log(t+1) - 26.8224 == 0;
t = solve(eqn, t)
t = 
vpa(t)
ans = 
13.617800523282271447111158159562

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Colormaps에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by