I want to divide x and y axis into 12 equal parts using grid lines with coordinates values seen visible in the respective places of x and y-axis
조회 수: 6 (최근 30일)
이전 댓글 표시
Hi all,
I want to divide x and y-axis into 12 equal parts with coordinate value seen visible in the 12 parts in x and y-axis using grid lines. I attached my code below,
format long
x = [0.05 0.05155 0.053266 0.055186 0.057362 0.059865 0.062803 0.066341 0.070755 0.076552 0.084804 0.098318 0.121708 0.125774 0.125797];
y = [0.05155 0.053266 0.055186 0.057362 0.059865 0.062803 0.066341 0.070755 0.076552 0.084804 0.098318 0.121708 0.125774 0.125797 0.125797];
scatter(x, y, '*', 'b');
hold all
line (x, y)
plot(x, y, 'r')
grid on
axis([0 0.18 0 0.18])
댓글 수: 0
채택된 답변
KSSV
2017년 7월 27일
Do interpolation using x qith equal 12 parts. Read about interp1.
x = [0.05 0.05155 0.053266 0.055186 0.057362 0.059865 0.062803 0.066341 0.070755 0.076552 0.084804 0.098318 0.121708 0.125774 0.125797];
y = [0.05155 0.053266 0.055186 0.057362 0.059865 0.062803 0.066341 0.070755 0.076552 0.084804 0.098318 0.121708 0.125774 0.125797 0.125797];
% interpolation
xi = linspace(min(x),max(x),12) ;
yi = interp1(x,y,xi) ;
scatter(xi, yi, '*', 'b');
hold all
line (xi, yi)
plot(xi, yi, 'r')
grid on
axis([0 0.18 0 0.18])
댓글 수: 2
KSSV
2017년 7월 27일
How it is the same previous plot? In (xi,yi) xi is divided into 12 equal parts....use (x,y) and (xi,yi) in plot and see.....
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Surface and Mesh Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!