I am trying to find the summation!!

2 views (last 30 days)
Avan Al-Saffar
Avan Al-Saffar on 26 Aug 2014
Commented: John D'Errico on 26 Aug 2014
My equation is
I = sum(delta t)
delta t = t(n+1) - t(n)
n=200;
could anyone help me to understand what is happening here if I am trying to get the result and what is the correct code for doing that please?
Thank you.
  3 Comments
Star Strider
Star Strider on 26 Aug 2014
Maybe I’m missing something, but if you’re summing the differences in t, isn’t that simply:
I = t(end)-t(1)
John D'Errico
John D'Errico on 26 Aug 2014
Several people have said that. But if you look at the comments made by Avan, you will see that the expressions of interest are not really as written in the question.

Sign in to comment.

Answers (2)

Image Analyst
Image Analyst on 26 Aug 2014
I don't know what result you want, but I do know that variable names cannot have spaces in them. It thinks they're two separate variables.
  4 Comments
Image Analyst
Image Analyst on 26 Aug 2014
Edited: Image Analyst on 26 Aug 2014
What about
dt = diff(t);
I = A*sum(dt)^2*a;
Patrik Ek
Patrik Ek on 26 Aug 2014
:) How about I = A*(t(end)-t(1))^(2*a). If this does not answer your question, please provide some more information about what you want to accomplish. It seems that there are some integration steps here that have not been explained properly.

Sign in to comment.


John D'Errico
John D'Errico on 26 Aug 2014
Edited: John D'Errico on 26 Aug 2014
Argh. I was trying to read your question to answer it. It made no sense at all, since your expression for I was completely wrong in the question you posed. Only in the comment to Image's answer do we see any clue. There we find MOST of what we need to compute the sum you wish to form. Maybe.
So A is a constant, and is irrelevant, unless there is something else you have not told us.
a however, is apparently crucial, and you tell us only that it is a long equation. So how can we possibly help you? We don't know what a is. Is it a function of n? Of what? If it is truly constant, then factor it out, and you have a simple sum.
What is the sum? The sum is apparently just a sum of squared differences of the vector t. Of course, you don't tell us what t is. I'm guessing that t is a known vector of length n. Or maybe not, and you have kept something else in the shadows. Is a maybe a function of t?
So MAYBE the answer is just
I = A*a*sum(diff(t).^2);
Or maybe not. The point is, you have offered insufficient information here, only doling it out in dribs and drabs when pressed for more. You have used non-standard terminology, partial pseudo-code certainly inconsistent with MATLAB notation.
Some of the things that are still unclear to me are in the pseudo-expression as you have written it in a comment:
I = A*sum(dt)^2*a
If sum is the MATLAB sum function, then sum(dt) seems to reduce trivially to t(end)-t(1). But are you squaring those terms or are you squaring the full sum? Or are you raising each term to the power (2*a)?
BE CLEAR ABOUT YOUR QUESTION. At least if you want a useful answer that does not involve wild guesses on our part. Often a theme is that when one cannot be clear about a question, it means that the person does not themselves really understand what it is they need to do. And if you cannot explain it clearly, then we certainly cannot help you.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!