Тёмный

Explanation of meshgrid function in Matlab 

Anselm Griffin
Подписаться 4,7 тыс.
Просмотров 1,4 тыс.
50% 1

This is a short tutorial on the purpose of meshgrid in Matlab.
Very simple introduction to meshgrid
In simple terms we want to get all the possible conbinations of x,y into a form known as X,Y
In the example below we have x as a 1*6
and y as a 1*5
We cannot multiply them as they are not not same size and nor can we do dot multiply i.e element by element multiplication.
Tidy up
clc
clear all
close all
Start the program
% problem we want to get every possible combination
% of x and y as laid out below
x = -2:3
x = 1×6
-2 -1 0 1 2 3
y = 4:8
y = 1×5
4 5 6 7 8
Get all the meshgrid
% X is a 5*6 ie 6 rows of -2 to + 3 inclusive
% Y is 5*6 i.e 6 columns of 4 to 8 inclusive
[X,Y] = meshgrid(x,y)
X = 5×6
-2 -1 0 1 2 3
-2 -1 0 1 2 3
-2 -1 0 1 2 3
-2 -1 0 1 2 3
-2 -1 0 1 2 3
Y = 5×6
4 4 4 4 4 4
5 5 5 5 5 5
6 6 6 6 6 6
7 7 7 7 7 7
8 8 8 8 8 8
as X and Y are both 5*6 we can now perform a dot multiply
% to a do multiply
F = X.*Y
F = 5×6
-8 -4 0 4 8 12
-10 -5 0 5 10 15
-12 -6 0 6 12 18
-14 -7 0 7 14 21
-16 -8 0 8 16 24

Опубликовано:

 

29 ноя 2021

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии    
Далее
Simple Examples Using Meshgrid in MATLAB
7:38
Lecture --  Meshgrid
10:44
Просмотров 12 тыс.
RATE THE TOUCH vs JUVENTUS ACADEMY 🙈
00:35
Просмотров 7 млн
MATLAB meshgrid, surf, and mesh 3D plotting
6:23
Просмотров 30 тыс.
"While Loops" and "For Loops" in MATLAB
9:24
Просмотров 20 тыс.
Using Meshgrid in Matlab
6:40
Просмотров 50 тыс.
MATLAB Video 24: The meshgrid function
9:22
Просмотров 11 тыс.
7.3 hold on command in MATLAB
18:34
Просмотров 4,7 тыс.
Simulating the Evolution of Rock, Paper, Scissors
15:00
Matlab Example for Linear Programming
7:44
Просмотров 109 тыс.