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

    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....


    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...

    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))];
    for j = 2:149
    y(j) = y(j-1) + x(j);

    for m = 1:149
    q(m)= 41904.076*y(m);
    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

Similar Threads for Matlab summation Date
MATLAB Matlab syntax for 2-d fourier transform Mar 21, 2016
Matlab summation of a complex function Mar 1, 2015
Matlab - Summation Oct 31, 2012
Matlab summations Sep 8, 2010
MATLAB Matlab code for summation? Apr 26, 2009