Results 1 to 2 of 2

Math Help - Matlab Trouble

  1. #1
    Newbie
    Joined
    Dec 2008
    Posts
    5

    Matlab Trouble

    hello, I am having some difficulties in runing this script:
    p(1)=0.5;
    q(1)=0.5;
    n(1)=0.5;
    k(1)=0.5;
    I(1)=p(1)*n(1);
    II(1)=p(1)*k(1);
    III(1)=q(1)*n(1);
    IV(1)=q(1)*k(1);
    W(1)=I(1)+II(1)+III(1)+IV(1);
    for j=1:3:10
    f=0+j*0.1;
    for d=1:1:4
    h=d*0.5;
    for z=1:2:11
    T=z-0.2;
    for i=1:20
    W(i+1)=I(i)+II(i)+III(i)+IV(i);
    R(i)=(1/(II(i)*III(i)*0.25+III(i)*I(i)*0.5+I(i)*IV(i)*0.25 +(III(i))^2+III(i)*IV(i)*0.5));
    s(i)=h*(II(i)*III(i)*0.25+III(i)*I(i)*0.5+I(i)*IV( i)*0.25)+((III(i))^2+III(i)*IV(i)*0.5);
    I(i+1)=(1/W(i+1))*(I(i)/(W(i))*(1-T)+p(i)*n(i)*h);
    II(i+1)=(1/W(i+1))*(II(i)/(W(i))*(1-T)+p(i)*k(i)*h);
    III(i+1)=(1/(W(i+1))*(III(I)*(1/W(i))+q(i)*n(i)*s(i)*R(i)));
    L(i)=(1/(IV(I)*III(i)*0.5+(IV(i))^2+IV(i)*II(i)*0.5+IV(i)* I(i)*0.25+III(i)*II(i)*0.25));
    Y(i)=h*(IV(i)*II(i)*0.5+IV(i)*I(i)*0.25+III(i)*II( i)*0.25)+(IV(I)*III(i)*0.5+(IV(i))^2);
    IV(i+1)=(1/W(i+1))*((IV(i)*(1/W(i)))+f*q(i)*k(i)*Y(i)*L(i));
    P(i+1)=I(i+1)+II(i+1);
    n(i+1)=I(i+1)+III(i+1);
    q(i+1)=III(i+1)+IV(i+1);
    K(i+1)=II(i+1)+IV(i+1);
    end
    end
    end
    end
    x=(1:i+1);
    figure(100*j+10*d+z)
    plot(x,I,x,II,x,III,x,IV);
    xlabel(
    'generation ');ylabel('population');


    It keeps giving me the error :??? Undefined function or method 'New' for input arguments of type 'char'.
    Why?What have I done wrong?
    any assistance would be most appriciated.
    Thanks
    Follow Math Help Forum on Facebook and Google+

  2. #2
    Member
    Joined
    May 2006
    Posts
    244
    Quote Originally Posted by Rorshach View Post
    hello, I am having some difficulties in runing this script:
    p(1)=0.5;
    q(1)=0.5;
    n(1)=0.5;
    k(1)=0.5;
    I(1)=p(1)*n(1);
    II(1)=p(1)*k(1);
    III(1)=q(1)*n(1);
    IV(1)=q(1)*k(1);
    W(1)=I(1)+II(1)+III(1)+IV(1);
    for j=1:3:10
    f=0+j*0.1;
    for d=1:1:4
    h=d*0.5;
    for z=1:2:11
    T=z-0.2;
    for i=1:20
    W(i+1)=I(i)+II(i)+III(i)+IV(i);
    R(i)=(1/(II(i)*III(i)*0.25+III(i)*I(i)*0.5+I(i)*IV(i)*0.25 +(III(i))^2+III(i)*IV(i)*0.5));
    s(i)=h*(II(i)*III(i)*0.25+III(i)*I(i)*0.5+I(i)*IV( i)*0.25)+((III(i))^2+III(i)*IV(i)*0.5);
    I(i+1)=(1/W(i+1))*(I(i)/(W(i))*(1-T)+p(i)*n(i)*h);
    II(i+1)=(1/W(i+1))*(II(i)/(W(i))*(1-T)+p(i)*k(i)*h);
    III(i+1)=(1/(W(i+1))*(III(I)*(1/W(i))+q(i)*n(i)*s(i)*R(i)));
    L(i)=(1/(IV(I)*III(i)*0.5+(IV(i))^2+IV(i)*II(i)*0.5+IV(i)* I(i)*0.25+III(i)*II(i)*0.25));
    Y(i)=h*(IV(i)*II(i)*0.5+IV(i)*I(i)*0.25+III(i)*II( i)*0.25)+(IV(I)*III(i)*0.5+(IV(i))^2);
    IV(i+1)=(1/W(i+1))*((IV(i)*(1/W(i)))+f*q(i)*k(i)*Y(i)*L(i));
    P(i+1)=I(i+1)+II(i+1);
    n(i+1)=I(i+1)+III(i+1);
    q(i+1)=III(i+1)+IV(i+1);
    K(i+1)=II(i+1)+IV(i+1);
    end
    end
    end
    end
    x=(1:i+1);
    figure(100*j+10*d+z)
    plot(x,I,x,II,x,III,x,IV);
    xlabel(
    'generation ');ylabel('population');


    It keeps giving me the error :??? Undefined function or method 'New' for input arguments of type 'char'.
    Why?What have I done wrong?
    any assistance would be most appriciated.
    Thanks
    When you run the script and generate the error message there will be a line number. When you click on the error message it will take you to the line with the error.

    .
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. I'm having trouble with this one
    Posted in the Differential Equations Forum
    Replies: 1
    Last Post: January 18th 2010, 05:00 AM
  2. trouble with e
    Posted in the Calculus Forum
    Replies: 3
    Last Post: October 18th 2009, 05:25 PM
  3. Car trouble
    Posted in the Advanced Applied Math Forum
    Replies: 1
    Last Post: November 26th 2008, 03:53 PM
  4. Replies: 5
    Last Post: April 3rd 2008, 02:19 PM
  5. having some trouble here!!
    Posted in the Trigonometry Forum
    Replies: 1
    Last Post: May 31st 2007, 04:03 AM

Search Tags


/mathhelpforum @mathhelpforum