Results 1 to 2 of 2

Math Help - Matlab help writting an equation

  1. #1
    Newbie
    Joined
    Dec 2009
    Posts
    5

    Matlab help writting an equation

    I don't understand what is wrong with this equation:
    Z=(n*R*y/(x-b))-((n.^2)*a)/(x.^2)

    Matlab keeps telling me:
    ??? Error using ==> mrdivide
    Matrix dimensions must agree.

    Error in ==> g261x05 at 11
    Z=(n*R*y/(x-b))-((n.^2)*a)/(x.^2)

    when I try and run:
    n=1.5; a=1.39; b=0.03913; R=0.08206
    y=[273:.1:473];
    x=[.3:.1:1.2];
    [X,Y]=meshgrid(x,y);
    Z=(n*R*y/(x-b))-((n.^2)*a)/(x.^2)
    surf(X,Y,Z)
    xlabel(
    'Volume (L)');
    ylabel(
    'Temperature (K)');
    zlabel(
    'Pressure (atm)')

    Please help!
    It's g285x07 in Gilat if you have the book.

    Thanks
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by LCuba View Post
    I don't understand what is wrong with this equation:
    Z=(n*R*y/(x-b))-((n.^2)*a)/(x.^2)

    Matlab keeps telling me:
    ??? Error using ==> mrdivide
    Matrix dimensions must agree.

    Error in ==> g261x05 at 11
    Z=(n*R*y/(x-b))-((n.^2)*a)/(x.^2)

    when I try and run:
    n=1.5; a=1.39; b=0.03913; R=0.08206
    y=[273:.1:473];
    x=[.3:.1:1.2];
    [X,Y]=meshgrid(x,y);
    Z=(n*R*y/(x-b))-((n.^2)*a)/(x.^2)
    surf(X,Y,Z)
    xlabel(
    'Volume (L)');
    ylabel(
    'Temperature (K)');
    zlabel(
    'Pressure (atm)')

    Please help!
    It's g285x07 in Gilat if you have the book.

    Thanks
    ./ for element by element division of the upper case variables you get from meshgrid

    CB
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Replies: 2
    Last Post: July 7th 2011, 12:21 PM
  2. Heat Equation on Matlab
    Posted in the Math Software Forum
    Replies: 2
    Last Post: April 9th 2011, 06:51 AM
  3. Replies: 0
    Last Post: March 5th 2011, 06:28 AM
  4. Writting Linear Functional as Direct Sum.
    Posted in the Advanced Algebra Forum
    Replies: 0
    Last Post: February 28th 2010, 01:57 AM
  5. Matlab Code Writting Help Needed
    Posted in the Math Software Forum
    Replies: 16
    Last Post: July 30th 2008, 08:38 AM

Search Tags


/mathhelpforum @mathhelpforum