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

MATLAB Matlab for summation

  1. Sep 23, 2010 #1
    Hi,

    I am trying to write a code for summation in matlab. I have two different text files with T and t in them.... I need to write a code that calculates....

    http://yfrog.com/5ocalculationj

    So, I have T1, T2, T3,T4,,,,,,, and t1 t2 t3 t4.... and i need to use the above equation.... this is the code i wrote...

    clc
    clear all
    load time.txt
    load temperature.txt

    T = temperature;
    t = time;
    for i = 1:149
    x(i) = [T(i+1)-T(i)]/[sqrt(t(150)-t(i+1))+sqrt(t(150)-t(i))];
    end
    x
    y(1)=x(1);
    for j = 2:149
    y(j) = y(j-1) + x(j);

    end
    y
    for m = 1:149
    q(m)= 41904.076*y(m);
    end
    q
    t_1 = t(1:end-1);
    plot (t_1,q)
    grid on



    the number 41904.076 is the value of the constant...

    I dont know what is wrong with the code but i am not getting the result i should be getting... any suggestions ??


    Thanks in advance....
     
  2. jcsd
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted