Simple Recurrence in Matlab
20 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Bryce Standkey
le 30 Mar 2017
Réponse apportée : bhavuk seth
le 7 Mai 2020
i have a question:
"Write a MATLAB program to compute wn for n = 1, 2, . . . , num where num is entered by the user, and display the values in two columns: n, wn (with appropriate headings)."
The recurrence for this question is W(0) = 25, Wn = W(n-1) +7 -(7*(n+1)/n) n ≥ 2
for the life of me i cant work out how to take this equation on matlab and take a "num" inputed by the user for the value of n
ie) n=1 W(1) = 25 + 7 - 14 = 18
n=2 W(2) = 18 + 7 - 10.5 = 14.5 and so on
0 commentaires
Réponse acceptée
KSSV
le 30 Mar 2017
N = 100 ;
W = zeros(N,1) ;
W(1) = 25 ;
for n = 2:N
W(n) = W(n-1) +7 -(7*(n+1)/n) ;
end
0 commentaires
Plus de réponses (2)
Avag Poghosyan
le 9 Jan 2019
N = 100 ;
W = zeros(N,1) ;
W(1) = 25 ;
for n = 2:N
W(n) = W(n-1) +7 -(7*(n+1)/n) ;
end
0 commentaires
bhavuk seth
le 7 Mai 2020
N = 100 ;
W = zeros(N,1) ;
W(1) = 25 ;
for n = 2:N
W(n) = W(n-1) +7 -(7*(n+1)/n) ;
end
0 commentaires
Voir également
Catégories
En savoir plus sur Programming Utilities dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!