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 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
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 Commenti
Risposta accettata
KSSV
il 27 Lug 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 Commenti
KSSV
il 27 Lug 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.....
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Surface and Mesh Plots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!