Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Problem with Matlab

  1. Jan 7, 2012 #1
    Hi everyone,

    I am having a bit of a problem with Matlab. I am currently using a finite difference mesh to solve the heat equation across one spatial dimension - x and time. I had an water array with depth and time and a boundary condition given by heat transfer equations which set the top line. This ran perfectly fine downwards from 2 : end-1

    I then added an array above it that was the same but had air properties. From this I set the bottom row to a boundary condition using the heat transfer equations and tried to run it the same way but upwards from end-1 : 2.

    It will not work and just alters the bottom row. The second differentials from the finite difference model come up as 0 despite their consituent parts clearly not adding to 0 uppon logging.

    (the model is trying to show heat interaction between an air layer sat on a water layer and heat transfer within the 2 layers in assumed to be conduction only)

    Can anyone suggest a solution to this or a problem it may be?

    Can MATLAB handle running upwards through a mesh?

    Thanks for any help, ( I am happy to give you more information)

    Matt
     
  2. jcsd
  3. Jan 7, 2012 #2
    Re: Matlab

    If you want to step in the negative direction you need to tell matlab so.

    Use: end-1 : -1: 2

    That should work
     
  4. Jan 9, 2012 #3
    Re: Matlab

    Thanks, I will try it now

    It didn't work. The only way I have been able to do it is by putting a new for loop in that runs a variable up the array and use that to work up the array but it looks a lot messier than it should be...
     
    Last edited: Jan 9, 2012
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Problem with Matlab
  1. Matlab scribt (Replies: 12)

  2. Learning Matlab (Replies: 3)

  3. A matlab question (Replies: 4)

Loading...