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

7 visualizaciones (últimos 30 días)
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])

Respuesta aceptada

KSSV
KSSV el 27 de Jul. de 2017
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 comentarios
KSSV
KSSV el 27 de Jul. de 2017
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.....

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by