Results 1 to 9 of 9

Math Help - Help with my project

  1. #1
    Newbie
    Joined
    Mar 2009
    Posts
    5

    Help with my project

    HI,
    i m a mech engg student currently working on a project to develop a mathematical model of a 4 cylinder diesel engine.
    the equation i m trying to solve in matlab is of the basic form

    Tcombustion + Tfriction+ Tmass = 0

    all the above parameters (T 's) are fuctions of the crank angle (y) and has sme 2nd order terms

    so i separated the 2nd order terms, 1st order terms and finally constant and created a seperate m-file for each of it

    1st term:

    term1=0.036+5*symsum((0.06)*(sin(y)+((0.5*sin(y)*c os(y))/sqrt(1- 0.025*(sin(y))^2)))1,2);

    2nd term:

    term2=(symsum((0.06)*(sin(y)+((0.5*sin(y)*cos(y))/sqrt(1-0.025*(sin(y))^2))),1,2))*(5*(0.06*cos(y)+(0.03125 *(sin(2*y))^2)/(1-0.025*(sin(y))^2)-(0.5*cos(2*y))/(sqrt(1-0.025*(sin(y))^2)))*y^2+(0.0025*symsum((0.06)*(sin (y)+((0.5*sin(y)*cos(y))/sqrt(1-0.025*(sin(y))^2))),1,2)));

    3rd term :

    term3=symsum((p2*y-p1)*ap*((0.06)*(sin(y)+((0.5*sin(y)*cos(y))/sqrt(1-0.025*(sin(y))^2)))),1,2);

    Well its actually a mess of a lot of terms in here

    now i hav to solve the 2nd order ode of the form

    Ay''+By'+Cy=0

    where A, B and C are the above terms

    now i wrote a separate m file for the function which is :

    function dydt=ode1(t,x)
    dydt=zeros(2,1);
    dydt(1)=x(2);
    dydt(2)=-b(x(2)) - c(x(1));

    where
    x=y'


    i m getting errors and not able to solve
    can u guys help me with this
    i m not sure but do i need to separate the 'y' terms in the equation ????
    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 Shinchan View Post
    HI,
    i m a mech engg student currently working on a project to develop a mathematical model of a 4 cylinder diesel engine.
    the equation i m trying to solve in matlab is of the basic form

    Tcombustion + Tfriction+ Tmass = 0

    all the above parameters (T 's) are fuctions of the crank angle (y) and has sme 2nd order terms

    so i separated the 2nd order terms, 1st order terms and finally constant and created a seperate m-file for each of it

    1st term:

    term1=0.036+5*symsum((0.06)*(sin(y)+((0.5*sin(y)*c os(y))/sqrt(1- 0.025*(sin(y))^2)))1,2);

    2nd term:

    term2=(symsum((0.06)*(sin(y)+((0.5*sin(y)*cos(y))/sqrt(1-0.025*(sin(y))^2))),1,2))*(5*(0.06*cos(y)+(0.03125 *(sin(2*y))^2)/(1-0.025*(sin(y))^2)-(0.5*cos(2*y))/(sqrt(1-0.025*(sin(y))^2)))*y^2+(0.0025*symsum((0.06)*(sin (y)+((0.5*sin(y)*cos(y))/sqrt(1-0.025*(sin(y))^2))),1,2)));

    3rd term :

    term3=symsum((p2*y-p1)*ap*((0.06)*(sin(y)+((0.5*sin(y)*cos(y))/sqrt(1-0.025*(sin(y))^2)))),1,2);

    Well its actually a mess of a lot of terms in here

    now i hav to solve the 2nd order ode of the form

    Ay''+By'+Cy=0

    where A, B and C are the above terms

    now i wrote a separate m file for the function which is :

    function dydt=ode1(t,x)
    dydt=zeros(2,1);
    dydt(1)=x(2);
    dydt(2)=-b(x(2)) - c(x(1));

    where
    x=y'


    i m getting errors and not able to solve
    can u guys help me with this
    i m not sure but do i need to separate the 'y' terms in the equation ????
    Well first of all I would not use symsum for the terms, but define them as matlab functions, assuming you are using matlab.

    CB
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie
    Joined
    Mar 2009
    Posts
    5
    Quote Originally Posted by CaptainBlack View Post
    Well first of all I would not use symsum for the terms, but define them as matlab functions, assuming you are using matlab.

    CB
    I m not able to solve it as i m new to matlab
    Last edited by Shinchan; March 13th 2009 at 09:30 PM.
    Follow Math Help Forum on Facebook and Google+

  4. #4
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by Shinchan View Post
    so can u help me simplify it....bcoz m a newbie in matlab
    I'm sorry but I cannot understand what you have posted, can you try some thing closer to English?

    CB
    Last edited by CaptainBlack; March 13th 2009 at 11:40 AM.
    Follow Math Help Forum on Facebook and Google+

  5. #5
    Newbie
    Joined
    Mar 2009
    Posts
    5
    Quote Originally Posted by CaptainBlack View Post
    I'm sorry but I cannot understand what you have posted, can you try some thing closer to English?

    CB
    Well let's remove the symsum function
    the error i m getting here is that the variable x(2) is being recognised as afunction in matlab
    hence it doesn't solve the function quoting that function x is not defined
    Follow Math Help Forum on Facebook and Google+

  6. #6
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by Shinchan View Post
    Well let's remove the symsum function
    the error i m getting here is that the variable x(2) is being recognised as afunction in matlab
    hence it doesn't solve the function quoting that function x is not defined
    First of all ask yourself what are a, b, and c in the derivative function?

    Are they scalars? If so the code is wrong because you are using them like functions of arrays.

    Are they functions? If so how does your code know this?

    In fact the function has no way of knowing what they are at all.

    CB
    Follow Math Help Forum on Facebook and Google+

  7. #7
    Grand Panjandrum
    Joined
    Nov 2005
    From
    someplace
    Posts
    14,972
    Thanks
    4
    Quote Originally Posted by Shinchan View Post

    term1=0.036+5*symsum((0.06)*(sin(y)+((0.5*sin(y)*c os(y))/sqrt(1- 0.025*(sin(y))^2))),1,2);
    I'm sorry to go back to these expressions, but there seems to be some ambiguity here in what the A, B and C are in your ODE. The expression above would if correct be a numeric constant, as symsum preforms a symbolic summation over whatever variable the automatic variable identification algorithm decides is the index of summation. In this case the variable of summation would be "y".

    This makes no sense to me, I expect the A, B and C to be either constants or functions of the independent variable (and for A and B possibly the dependent variable).

    It would help if you could tell us what the coefficients are meant to be in some notation other than Matlab code. My suspicion is that these are functions and would be best declared as subfunctions of your derivatives function.

    CB
    Follow Math Help Forum on Facebook and Google+

  8. #8
    Newbie
    Joined
    Mar 2009
    Posts
    5
    Quote Originally Posted by CaptainBlack View Post
    I'm sorry to go back to these expressions, but there seems to be some ambiguity here in what the A, B and C are in your ODE. The expression above would if correct be a numeric constant, as symsum preforms a symbolic summation over whatever variable the automatic variable identification algorithm decides is the index of summation. In this case the variable of summation would be "y".

    This makes no sense to me, I expect the A, B and C to be either constants or functions of the independent variable (and for A and B possibly the dependent variable).

    It would help if you could tell us what the coefficients are meant to be in some notation other than Matlab code. My suspicion is that these are functions and would be best declared as subfunctions of your derivatives function.

    CB
    Ahh, i got your point. i made a mistake that i declared the constants A, B and C as functions of y (which is wrong, they must be constants)
    so now i need to separate the constant terms from 'y' terms (ie sin(y) and cos (y) should be separated).
    Thanks.
    Follow Math Help Forum on Facebook and Google+

  9. #9
    Newbie
    Joined
    Mar 2009
    Posts
    5
    I tried to simplify my problem so i calculated values of some constant terms and the tried to solve the 2nd order ODE but i got following problems.......

    Constant values previously calculated...
    Tf
    Tc
    djdy

    M-file: (for ODE)

    function dxdy = ode (t,x)
    dxdt = zeros (2,1);
    dxdt(1) = Tf .* x(1) - djdy .* x(1) + Tc ;
    dxdt(2) = x(2);


    command :

    [t x] = ode45( @ode , [1 : 0.5 : 10] , 0)

    Errors:

    Warning: Could not find an exact (case-sensitive) match for 'Tf'. F:\Matlab\toolbox\control\control\@tf\tf.m is a case-insensitive match and will be used instead. You can improve the performance of your code by using exact name matches and we therefore recommend that you update your usage accordingly. Alternatively, you can disable this warning using warning('off','MATLAB:dispatcher:InexactMatch').
    > In ode at 3
    In funfun\private\odearguments at 110
    In ode45 at 173
    ??? Function 'times' is not defined for values of class 'tf'.

    Error in ==> times at 18
    [varargout{1:nargout}] = builtin('times', varargin{:});

    Error in ==> ode at 3
    dxdt(1) = Tf .* x(1) - djdy .* x(1) + Tc ;

    Error in ==> funfun\private\odearguments at 110
    f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.

    Error in ==> ode45 at 173
    [neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, ...




    Please help me!!!!!
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. GCD Project
    Posted in the Number Theory Forum
    Replies: 1
    Last Post: February 18th 2011, 03:07 AM
  2. Project help
    Posted in the Calculus Forum
    Replies: 3
    Last Post: March 22nd 2010, 08:54 PM
  3. CAL 1 Project 2
    Posted in the Calculus Forum
    Replies: 1
    Last Post: March 31st 2008, 10:01 AM
  4. Project - I need some serious help.
    Posted in the Calculus Forum
    Replies: 4
    Last Post: December 17th 2007, 11:03 PM
  5. Project HELP!
    Posted in the Calculus Forum
    Replies: 1
    Last Post: October 24th 2007, 06:11 AM

Search Tags


/mathhelpforum @mathhelpforum