Defining the position of element in a multi dimensional array

1 回表示 (過去 30 日間)
GEON G BASTIAN
GEON G BASTIAN 2020 年 2 月 19 日
回答済み: Koushik Kureti 2020 年 3 月 5 日
Hello Everyone!
Here I have a ground plane of certain user inputted dimension. I want to find the distance of each point on the ground plane to the conductor.
The points are defined by u and v with v being along l and u being along b. I need to know how to define the ground plane as a 2 dimensional array.
clc
clear all
clearVars
l = input ( 'Enter the length of GND in m =' );
b = input ( 'Enter the breadth of GND in m =' );
c = input ( 'Enter the height of the cable from the GND in m =' );
h = input ( 'Enter the height of the probe line from the GND in m =' );
u = -b / 2: 0.1: b / 2;
v = -1 / 2: 0.2: 1/2;

回答 (1 件)

Koushik Kureti
Koushik Kureti 2020 年 3 月 5 日
Hello GEON G BASTIAN,
You can define the ground plane as a 2-dimensional array by declaring a 2-dimensional variable groundPlane whose each element is a cell array consists of 2 elements (u, v) as show below
l = input ( 'Enter the length of GND in m =' );
b = input ( 'Enter the breadth of GND in m =' );
c = input ( 'Enter the height of the cable from the GND in m =' );
h = input ( 'Enter the height of the probe line from the GND in m =' );
u = -b / 2: 0.1: b / 2;
v = -1 / 2: 0.2: 1/2;
for i = 1:numel(u)
for j = 1:numel(v)
groundPlane{i,j} = [u(i) v(j)];
end
end

カテゴリ

Help Center および File ExchangeMathematics についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by