Summation with For LOOP (iterations)

so this is the summation I am working with. I have four constants of ki and zi. I am looking for (V/F). I think I am suppose to use iterations to find the answer? I don't really know. Any advice to get stated will really help.
ki=[56, 0.65, 0.175, 0.055];
zi=[0.5, 0.1, 0.15, 0.25];
xl=0;
for i=0.1:length(1)
xl=xl+(zi(ki-1))/(1+i(ki-1));
end
What I did so far.... (replaced V/F with i)

2 commentaires

madhan ravi
madhan ravi le 13 Avr 2021
Aren't V and F supposed to be scalars?
Rebecca Reyes
Rebecca Reyes le 13 Avr 2021
I really dont know. The answer for V/F=.59 if done correctly.

Connectez-vous pour commenter.

Réponses (1)

Jan
Jan le 13 Avr 2021
K = [56, 0.65, 0.175, 0.055];
Z = [0.5, 0.1, 0.15, 0.25];
fcn = @(x) sum(Z .* (K - 1) ./ (1 + x * (K - 1)))
fzero(fcn, 0.5)
% 0.591015474362563
There are some more zeros: at 1.15928465237477 and 2.63599135955416. See:
fplot(fcn)

3 commentaires

Rebecca Reyes
Rebecca Reyes le 14 Avr 2021
Modifié(e) : Rebecca Reyes le 14 Avr 2021
Hi! thank you for answering! but is there any way I can solve for the equation using a for or while loop? initial guess for V/F is 0.1
Rebecca Reyes
Rebecca Reyes le 14 Avr 2021
sorry i didnt ask clearly before
Jan
Jan le 14 Avr 2021
@Rebecca Reyes: Your questions about Matlab are welcome. If all details are clear already, it would not be a problem anymore.
Of course you can find the solution by your own with a loop also. Implement a Newton-Raphson-method. You can get the differentiation of the function numericalls. A colleague of mine has implemented this for large systems and published the code as his PhD. Of course an iterative solver for small problem can be written with less than 100 lines of code also, but it is not as trivial as "using a FOR oder WHILE loop".

Connectez-vous pour commenter.

Catégories

En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange

Commenté :

Jan
le 14 Avr 2021

Community Treasure Hunt

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

Start Hunting!

Translated by