- Initialize “sum1” and “sum2” as 0
- Initialize a value of “N”
- Start a for loop from 1 to “N”
- Update sum1 by incrementing it with “10^(k-1)”
- After the for loop, update “sum2” as “0.1*10^N” as using for loop here would increase the time complexity exponentially.
- Finally take the difference of “sum1” and “sum2”.
Using summation and series to create a function to analyse and find error
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I have a series of 10^(N-1) minus a summation of k=1 to 10^(N) of 0.1. I havn't worked with sums and series in a while and was wondering how to get exact value of N and what ever information you could give on composing the function with a for loop. I think that might help me figure out the function I need to create in my project. I have seen a lot of information on summations and how to put into a script in matlab, but I have found nothing on how I can do this with a power of N on the upper limit. Thankyou in advance. Any information you can provide would be helpful. P.S. Yes, I have looked up how to do summations in matlab and have not yet found how to do this particular problem. I know I need to use a for loop.
0 Commenti
Risposte (1)
Binaya
il 19 Ott 2023
Hi Richard,
Based on your description, you would like to develop a MATLAB code using for loop for the series “10^(N-1)” and a summation of “k=1 to 10^(N)” of “0.1”, and take its difference.
Please find the below algorithm as a possible solution to your query:
Please refer to the below Mathworks documentation for more reference:
I hope this helps.
Regards
Binaya
0 Commenti
Vedere anche
Categorie
Scopri di più su Loops and Conditional Statements in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!