Chiziqli grafiklar
Mashinali o‘rganishda bog‘liqliklarni ko‘rsatish uchun ko‘pincha chiziqli grafiklardan foydalaniladi.
Chiziqli grafik chiziqli funksiyaning qiymatlarini ko‘rsatadi: y = ax + b
Muhim kalit so‘zlar:
- Chiziqli (to‘g‘ri)
- Qiyalik (burchak)
- Kesishma (boshlang‘ich qiymat)
Chiziqli
Chiziqli — to‘g‘ri degani. Chiziqli grafik — bu to‘g‘ri chiziq.
Grafik ikkita o‘qdan iborat: x o‘qi (gorizontal) va y o‘qi (vertikal).
Misol
const xValues = [];
const yValues = [];
// Generate values
for (let x = 0; x <= 10; x += 1) {
xValues.push(x);
yValues.push(x);
}
// Define Data
const data = [{
x: xValues,
y: yValues,
mode: "lines"
}];
// Define Layout
const layout = {title: "y = x"};
// Display using Plotly
Plotly.newPlot("myPlot", data, layout);
O‘zingiz sinab ko‘ring »
Qiyalik
Qiyalik — grafikning og‘ish burchagi.
Qiyalik — chiziqli grafikdagi a qiymati:
y = ax
Ushbu misolda qiyalik = 1.2:
Misol
let slope = 1.2;
const xValues = [];
const yValues = [];
// Generate values
for (let x = 0; x <= 10; x += 1) {
xValues.push(x);
yValues.push(x * slope);
}
// Define Data
const data = [{
x: xValues,
y: yValues,
mode: "lines"
}];
// Define Layout
const layout = {title: "Slope=" + slope};
// Display using Plotly
Plotly.newPlot("myPlot", data, layout);
O‘zingiz sinab ko‘ring »
Kesishma (intercept)
Kesishma — grafikning boshlang‘ich qiymati.
Kesishma — chiziqli grafikdagi b qiymati:
y = ax + b
Ushbu misolda qiyalik = 1.2 va kesishma = 7:
Misol
let slope = 1.2;
let intercept = 7;
const xValues = [];
const yValues = [];
// Generate values
for (let x = 0; x <= 10; x += 1) {
xValues.push(x);
yValues.push(x * slope + intercept);
}
// Define Data
const data = [{
x: xValues,
y: yValues,
mode: "lines"
}];
// Define Layout
const layout = {title: "Slope=" + slope + " Intercept=" + intercept};
// Display using Plotly
Plotly.newPlot("myPlot", data, layout);
O‘zingiz sinab ko‘ring »
W3Schools Pathfinder
Yutuqlaringizni kuzating – bu bepul!
