# create a test environment with the size 10x10x10cm

1 visualización (últimos 30 días)
sia el 29 de Mayo de 2013
Hi,
i wanna create a test environment with the size 10x10x10 cm. This should be my workspace and there is no electrical resistance or something like that. there is only air. Then i want to place a cube in the center of that.
But I dont know, how i can create such of matrix.
Can u guys help me pls??? THX
##### 2 comentariosMostrar NingunoOcultar Ninguno
Walter Roberson el 29 de Mayo de 2013
How finely grained should the cube be? If it is 10 cm per side, do you need it sub-divided into mm ? You mention electrical resistance and air: if you are going to model air-gap electric field breakdowns, then 1 mm per step might be too much for realistic modelling.
Walter Roberson el 29 de Mayo de 2013

Iniciar sesión para comentar.

### Respuestas (2)

Muruganandham Subramanian el 29 de Mayo de 2013
Editada: Muruganandham Subramanian el 29 de Mayo de 2013
>> B = zeros(10,10,10); %Try this
##### 3 comentariosMostrar 1 comentario más antiguoOcultar 1 comentario más antiguo
Muruganandham Subramanian el 29 de Mayo de 2013
sia el 29 de Mayo de 2013
Editada: sia el 29 de Mayo de 2013
I dont think this link helps me :(.... I wanna write a function to build that. something like that:
function test_environment
x = 10;
y = 10;
z = 10;
workspace = zeros(x,y,z);
for i=1:1:x
for j=1:1:y
for k=1:1:z
% here i have to include the second matrix B = onse(2,2,2)
end
end
end
end
But i dont know how :( Any idea?

Iniciar sesión para comentar.

sia el 29 de Mayo de 2013
I changed my funktion to this :
function test_environment
workspace = zeros(10,10,10);
cube = ones(2,2,2);
[r,c,d]=size(cube);
xpos=2;ypos=2;zpos=2;
workspace(xpos:xpos+r-1,ypos:ypos+c-1,zpos:zpos+d-1)=B;
end
but when i try to call it like this :
>> test_environment
i get this error:
Undefined function or variable 'test_environment'.
do u se my fail???
##### 2 comentariosMostrar NingunoOcultar Ninguno
Walter Roberson el 29 de Mayo de 2013
You need to save that code to test_environment.m somewhere on your MATLAB path.
Note: you will not see any output from this function. When it executes it will construct values within its local workspace, and then when the function executes the workspace will be destroyed, leaving you with no net effect.
sia el 29 de Mayo de 2013
I found this problem thx :)
another question: i wanna display the result i use at the mom
printmat(workspace )
but this is not smart. because i gt this:
--1--> --2--> --3--> --4--> --5-->
--1--> 0 0 0 0 0
--2--> 0 0 0 0 0
--3--> 0 0 0 0 0
--4--> 0 0 0 0 0
--5--> 0 0 0 0 0
--6--> 0 0 0 0 0
and .... I think i get all columns, how can i formate this?????

Iniciar sesión para comentar.

### Categorías

Más información sobre MATLAB en Help Center y File Exchange.

### Community Treasure Hunt

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

Start Hunting!

Translated by