필터 지우기
필터 지우기

How to set x > 0, at 2nd order polynomial using polyfit.

조회 수: 2 (최근 30일)
Nurul Hazira
Nurul Hazira 2021년 5월 6일
댓글: Nurul Hazira 2021년 5월 6일
Hi I need help, I have imported a txt file into my matlab and have set the x and y value, then I got stuck to create the line on graph at x > 0. Below is my normal code without set x > 0.
p2 = polyfit(x,y,2);
f = polyval(p2,x);
plot(x,f,'-')

채택된 답변

KSSV
KSSV 2021년 5월 6일
idx = x > 0 ;
x = x(idx);
y = y(idx) ;
p2 = polyfit(x,y,2);
f = polyval(p2,x);
plot(x,f,'-')

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

태그

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by