I want to create a matlab program to perform this operation and show the result in each operation in table
Ältere Kommentare anzeigen
X(i)=sumation of x(i-k)*f(k) Where i=1:200,k=1:i,f(k) is a function
21 Kommentare
Walter Roberson
am 27 Jun. 2021
That looks like a convolution. See conv()
Note: you might need to fliplr(x)
Maha Ahmed
am 27 Jun. 2021
Walter Roberson
am 28 Jun. 2021
if x and f are functions then you should be using integral instead of summation, and you will find that you have matched the definition of convolution.
If f and x are vectors being indexed then what you have matches conv()
Maha Ahmed
am 28 Jun. 2021
Maha Ahmed
am 28 Jun. 2021
Walter Roberson
am 29 Jun. 2021
what should I do with (gui) ,i perform ft,rt with plot
I do not know what ft and rt are in this context?
and operate Handel function to calculate ft at all values from 0:200
I do not understand about "operate Handel function" ? If you mean "handle function" then I still do not understand?
The main task is to design a program to calculate the value of d(demand) at any required point
What is d in this context?
When you create your GUI, what inputs will the user have? What drop-down or listbox selection boxes will be provided to them, and what will they choose between? What pushbuttons will be provided, and what will those activate? What is the required output?
Maha Ahmed
am 30 Jun. 2021
Bearbeitet: Walter Roberson
am 30 Jun. 2021
Walter Roberson
am 1 Jul. 2021
Have you taken the MATLAB Onramp course?
Are you familiar with the purpose of using functions, and how you can program functions in MATLAB?
Maha Ahmed
am 1 Jul. 2021
Walter Roberson
am 1 Jul. 2021
Generally speaking, organizing work into functions saves time, because you can debug the function separately.
A lot of the time when you are programming, you end up in situations where you have code that looks something like
first group of statements that produces some variables
second group of statements that uses the variables
where as far as the second group of statements is concerned, it does not matter how the first group of statements does its work, as long as particular variables are constructed correctly; and likewise that the first group of statements does not care how the second group of statements will use the variables.
In such a situation, it can often make sense to move the statements into functions,
[variable1, variable2, variable3] = first_function(input1, input2, input3);
[variable4, variable5] = second_function(variable1, variable2, variable3);
and then you
function [out1, out2, out3] = first_function(in1, in2, in3)
first group of statements
end
function [out4, out5] = second_function(in4, in5, in6)
second group of statements
end
Then you can change how first_function does its work without having to change how second_function does its work.
Breaking up code this way makes the original code more compact, allowing you to see more clearly what work it is intended to do. Also, breaking up the code like this reduces the number of accidental reliances between the first and the second group of code.
When code is broken up into functions with well-defined purposes, then often it turns out to be possible to re-use the function for other purposes, perhaps in other programs. Or it turns out that there are multiple places in the code where you did the same kind of logic (but perhaps with different variables), and then putting the logic into a function means you only have to debug the logic once, and the different places you had the logic do not get out of synchronization with each other (if you had written out code 5 times and notice a bug in one of the places and fix it, are you always going to remember to fix the other 4 places a well ?)
Maha Ahmed
am 1 Jul. 2021
Walter Roberson
am 1 Jul. 2021
Your image of your equation leaves me with a number of questions.

- A: what is the subscript on the fand is that the same subscript as on the α at location C ?
- B: is that the same α as the one at location C ? It does not have any subscript or indexing, so maybe it refers to the whole vector α that is defined at location C? If so then f would have to return a vector value. And is the second α, the
the same α ? - C: what is the subscript on the α and is it the same as on the f at location A?
- D: That is the same subscript on the α at location C, right? So the vector is being defined iteratively. But to do that, you have to know
-- unless what you are establishing is a series of simultaneous equations where each
is being defined as the value that makes the entire system work out - E: what is the upper bound on that summation? It looks like maybe the variable of summation is l (lower-case L), but for the upper bound I cannot read what it is equal to. Something minus 1.
maybe? I cannot see any dot on whatever it is. - F: what is the upper bound on the K summation? Is it i ?
- The bit at the bottom about for 0 ≤ something ≤ N -- what is the something? Is it t (lower-case T) ? Is it i (lower-case I) ? It looks most like a t but it would make more sense for it to be i
- The definition of f in location A: is that
(M subscript lower-case F) ? Is that a named constant that is independent of the
(M subscript lower-case R) in the definition of R(t) ? Or is that a vector M being indexed? - The definition of R(t) looks to be using
(a subscript r), and that a is not α (alpha). Then in the definition of f(t) at location A, there is an a subscript something. Is that subscript t? Is it 1 (digit 1) ? - The definition of R(t) involes
and σ with no subscript, and the definition of f(t) involves
or maybe it is
or maybe it is
: what is the relationship between those σ?
does not seem to be defined?
Maha Ahmed
am 1 Jul. 2021
Bearbeitet: Walter Roberson
am 1 Jul. 2021
Maha Ahmed
am 1 Jul. 2021
Bearbeitet: Walter Roberson
am 1 Jul. 2021
Maha Ahmed
am 1 Jul. 2021
Maha Ahmed
am 4 Jul. 2021
Walter Roberson
am 4 Jul. 2021
I have lost track of what it is you are asking at this point ??
Maha Ahmed
am 8 Jul. 2021
Walter Roberson
am 8 Jul. 2021
You did not post a copy of your code (only an image of part of it). You did not attach your fig file. You did not post an error message or ask any specific question.
Volunteers might assist you with your code, but we are not going to write your code for you.
Maha Ahmed
am 10 Jul. 2021
Walter Roberson
am 11 Jul. 2021
for t=2:200
sum=0
for j=2:t
sum=sum+sum(t-j).*f(j)
end
v(t)=sum
end
t starts at 2. j starts at 2. t-j starts at 0. sum starts at the scalar 0. sum(t-j) would be sum(0) which is an invalid index.
The associated logic never stores more than 1 value in sum so sum can only be indexed at 1 (or true)
Reminder that matlab does not support implied multiplication. If you want multiplication then you need to use a multiplication operator.
Akzeptierte Antwort
Weitere Antworten (2)
Mahaveer Singh
am 13 Jul. 2021
1 Stimme
S=0;
x(1)=0; % initial value of x.
for i=2:1:200
for k=1:1:i-1
S(k)=x(i-k).*f(k);
end
x(i)=sum(S);
end
sumation=x
1 Kommentar
Maha Ahmed
am 13 Jul. 2021
Sara Boznik
am 27 Jun. 2021
part=0;
sumation=0;
for i=1:1:200
for k=1:1:i
part=x(i-k).*f(k)
sumation=sumation+part
end
end
Sumation is x(i).
4 Kommentare
Maha Ahmed
am 27 Jun. 2021
Maha Ahmed
am 27 Jun. 2021
Sara Boznik
am 27 Jun. 2021
yeah and what is f(k)?
Maha Ahmed
am 27 Jun. 2021
Kategorien
Mehr zu Scripts finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




