| New Reply |
calculating, among the points of a mesh, only a few points with a different equation. |
Share Thread | Thread Tools |
| May28-12, 06:16 PM | #1 |
|
|
calculating, among the points of a mesh, only a few points with a different equation.
Hello again!
Let's say that i am calculating every element of a 100X300 table by using equation A I use two for loops (i m doing this in matlab) for i=1:100 for j=1:300 element(i,j)=... (it is the equation A) end end equation A involves the neighboring elements What if, a few elements of the table must be calculated with a different equation, equation B and this must happen inside the two for loops for example elements (49,81) (49,82) (50,81) (50,82) (51,81) (51,82) (52,81) (52,82) i could use if and elseif function for every single element, like if i==49 && j==81 element(i,j)=...equation B elseif i==50 && j==81 element(i,j)=...equation B ... ... end Is there another, better way to do it ??? Thanks a lot! |
| May29-12, 06:54 AM | #2 |
|
|
I've attached a picture of what I mean implemented in Mathcad. I'm presuming that you can't take B outside of the loop. NR |
| May29-12, 07:08 AM | #3 |
|
|
... a quick glance at the Matlab documentation suggests that, although this might be possible, a better route to go might be to create a structure array of f's and g's handles. NR |
| May31-12, 09:56 AM | #4 |
|
|
calculating, among the points of a mesh, only a few points with a different equation.
Thanks a lot mate!
|
| New Reply |
| Thread Tools | |
Similar Threads for: calculating, among the points of a mesh, only a few points with a different equation.
|
||||
| Thread | Forum | Replies | ||
| Classical Mechanics: Finding force, equilibrium points, turning points.... | Advanced Physics Homework | 6 | ||
| ordinary points, regular singular points and irregular singular points | Differential Equations | 3 | ||
| Find all the limit points and interior points (basic topology) | Calculus & Beyond Homework | 2 | ||
| Points, Lines, and Planes in 3D Space! Given 3 points find a plane... | Calculus & Beyond Homework | 10 | ||
| Two points on a graph, the mid-point of a line made by these two points is an origin. | Precalculus Mathematics Homework | 6 | ||