My mesh grid is giving me a value not a matrix

2 ビュー (過去 30 日間)
Dervon Parchment
Dervon Parchment 2021 年 10 月 21 日
編集済み: Dave B 2021 年 10 月 21 日
I put in the code x=[-5.0e-9:5.0e-9] and y=[-5.0e-9:1.0e-9] and [X,Y]=meshgrid(x,y) and it just gives me -5.0000e-9 instead of a matrix, what am I doing wrong

回答 (1 件)

Dave B
Dave B 2021 年 10 月 21 日
編集済み: Dave B 2021 年 10 月 21 日
The question is: how many points do you want in your grid?
The : operator, by itself, takes increments of 1:
5:10
ans = 1×6
5 6 7 8 9 10
The min and max in your x are (much) less than one apart, so x and y are scalars, so your grid is a scalar:
x=[-5.0e-9:5.0e-9]
x = -5.0000e-09
y=[-5.0e-9:1.0e-9]
y = -5.0000e-09
You could specify a spacing like this:
x=-5.0e-9:1e-10:5.0e-9;
size(x)
ans = 1×2
1 101
size(meshgrid(x,x))
ans = 1×2
101 101
Or a number of points like this:
x=linspace(-5.0e-9,5.0e-9,50);
size(x)
ans = 1×2
1 50
size(meshgrid(x,x))
ans = 1×2
50 50

カテゴリ

Help Center および File ExchangeAntennas and Electromagnetic Propagation についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by