Hello again!(adsbygoogle = window.adsbygoogle || []).push({});

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!

**Physics Forums - The Fusion of Science and Community**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Calculating, among the points of a mesh, only a few points with a different equation.

Loading...

Similar Threads - Calculating among points | Date |
---|---|

[Maple] Calculating the potential produced by a charge | Feb 27, 2017 |

Storing calculations into a list | Feb 26, 2016 |

Adding restrictive conditions to a limit calculation | Jan 28, 2016 |

Huge Archive of Mathematical Links (among other diciplines) | Mar 31, 2007 |

**Physics Forums - The Fusion of Science and Community**