Search results

  1. M

    Newton for a 4x4 system of nonlinear eqns

    Hi All. I think i figured it out... i am attaching the program below for a linear set of eqns... that was just to verify that all is working well... however, i was told that the method should converge in one iteration for a linear system, and for me it happens in 3.. am i doing something wrong...
  2. M

    MATLAB Setting up Newton Raphson integral with matlab

    Thanks Gib. I figured where i went wrong.. i still have a question that i will post later today
  3. M

    MATLAB Double integrals with matlab

    Now, this is giving me the corrrect answer but not sure if i cheated in a way or not... what do you think: close all clear all x0=0; xt=1; xstep=110; dx=1/(xstep-1); y0=0; yt=1; ystep=110; dy=1/(ystep-1); sum2=0; for i1=1:ystep+1 sum1=0; y=(i1-1)*dy; x2step=floor(y/dx)...
  4. M

    MATLAB Double integrals with matlab

    oh... forgot to say that I am using trapazoidal rule for the integration
  5. M

    MATLAB Double integrals with matlab

    the program that i put together is giving me the integral=24.8427 and the answer is actually 0.316... my program is copied below, what am i doing wrong: x0=0; xt=1; xstep=11; dx=1/(xstep-1); y0=0; yt=1; ystep=11; dy=1/(ystep-1); sum2=0; for i1=1:xstep sum1=0; y=(i1-1)*dy...
  6. M

    MATLAB Double integrals with matlab

    Hi Everyone. I would like to integrate the following using matlab: \int_0^1 ~\int_0^x e^{-x^2} ~dy ~dx looks pretty simple but don't know how to set up the embedded for loops for the integral with in the integral especially that the upper limit of the inner integral is x and not a number...
  7. M

    Newton for a 4x4 system of nonlinear eqns

    Hi All. Can somebody give me a sample matlab code for Newton-Raphson Method for Nonlinear 4x4 System of Equations. I'm trying to set a very ugly one up and haven't seen NR before the beginning of this week. I've figured the NR for a single eqn but this is driving me nuts.
  8. M

    MATLAB Setting up Newton Raphson integral with matlab

    Hi All. I have an equation that i want to numerically find the root of by using Newton Raphson. However the equation involves an integral which i am using the trapazoidal rule to evaluate. And here is the simplified version of it: 1 = e^{-cy} \int_0^1 e^{-y(1-x)} dx So i am supposed...
  9. M

    Partial derivative

    Try this: replace every x with the constant a... now the equation should look like it is in one variable, y. So what you need now is to find the second derivative with respect to y. Does that make life easier?
  10. M

    Matlab animation - how to from figures

    Compared to the questions out there, my question seems VERY SIMPLE. I have a code that generates a few graphs. Instead of super-imposing the graphs on one figure, I would like matlab to generate an animation of those graphs for me. I tried looking at help and my intution tells me that...
  11. M

    Fortran Beginner fortraner: messing up arithmatic

    Thanks a lot Borek. I changed Xstep and Nstep from integers to real and now the calculations come out right. I am sure i will have another silly question in a few minutes and your help is muuuuuuuuuuuuuuuuuuuuuuuuuuuuch appreciated
  12. M

    Fortran Beginner fortraner: messing up arithmatic

    Hi All. I am trying to rewrite a program that i have in matlab to one in fortran. as i chug along, i am comparing the results and i am getting funny answers. This is the program in have in fortran so far: ccccccccccccccccccccccccccccccccccccccccccccccccc program main implicit...
  13. M

    MATLAB Matlab - number format

    Thank you for your reply. i tried the first few before posting my question and could not really figure it out. any advice as to which specific option to use?
  14. M

    Fortran Beginner fortran question - starting with a new slate

    Thanks for the prompt reply Borek. I am glad I asked instead of banging my head against the screen until next week. Thanks again.
  15. M

    MATLAB Matlab - number format

    Hi All Matlab is displaying numbers with 4 decimal places and i hate when it does that for whole numbers. for example i have a matrix C(i) that starts off from 1 down to 150/275. When i multiply it by 275 i get the first entry as 275.0000 and the last as 150.0000 how do i turn that off or...
  16. M

    Fortran Beginner fortran question - starting with a new slate

    Hi All I am new to fortran and there are things that I believe fortran should do and don't know how to do it - I am using fortran 77. 1- I know how to declare variables, but i do not know how to make sure that i start out with zeros and not use old data that might have been stored by a...
  17. M

    MATLAB Matlab figure: axis re-labelling

    Just tried it. Worked perfectly. Thanks a lot Chrisas.
  18. M

    MATLAB Matlab figure: axis re-labelling

    this is what i am using plot(y); and it is plotting y vs. t. the plotting itself is not the problem... i simply want the t-axis to be re-labeled... instead of the tick marks showing from 0 to 160, i want the change to be only in the tick marks and want it to show from 0 to 1 with increments of...
  19. M

    MATLAB Matlab figure: axis re-labelling

    I did... and tried this set(gca,'XTick',-pi:pi/2:pi) set(gca,'XTickLabel',{'-pi','-pi/2','0','pi/2','pi'}) but could not figure out a way for the conversion... here are more specifics... i am running the integration for t=1 and time step dt=.0063 which makes the total number of n around...
  20. M

    MATLAB Matlab figure: axis re-labelling

    Hi all. i am integrating in matlab and plotting the results in a y-verically and t-horizontally. Matlab automatically plots y versus the time step which is great. but what i need to do is re-label the t-axis so the actual time appears instead of the time step- so instead of from 0 to 1200, it...
Top