04-22-2012 12:43 PM
i'm using a matalb script and trying to implement a boundary condition into my 3d array...i have already completed the arrays using labview but am not sure how to set the conditions. part of the code is as follows:
u(1,:,n+1) = u(2,:,n+1) ;
u(length(x),:,n+1) = u(ni-1,:,n+1) ;
u(:,1,n+1) = -u(:,2,n+1) ;
u(:,length(y),n+1) = -u(:,nj-1,n+1) ;
many thanks
04-22-2012 01:28 PM
Use Index Array and Replace Array Subset. Also, keep in mind that LV array indexes start at 0 and go to length - 1 unlike Matlab.
Lynn
04-22-2012 01:32 PM
but how would i equate them? would it be possible to get a simple example?
many thanks
04-22-2012 02:35 PM
Here is a simple brute force 2D example. It could also be done in a loop with a shift register and a case structure. That method would be easier to expand to multiple dimensions.
In looking back at your Matlab code, I think I swapped things in the reverse order. You can switch index inputs on Index Array and Replace Array Subset to get the order you need. I did not look at the corners. My code fills boundary rows first. This may not put the value you want in the corners.
Lynn
04-23-2012 05:58 AM
How can i set somethin to equal a negative array?
04-23-2012 10:14 AM
I do not understand that question. Can you post an example of what you are trying to do? Include some typical data and show what the output should be.
Lynn