Error approximation as a function
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
I have this error approximation ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/241385/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/241385/image.png)
and I am trying to create two functions. One which loops over the values
and the second which loops over input x values. So far I have
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/241386/image.png)
function b = erff(x,N);
xx=-x^2;
a=x; b=a; c=1;
while(abs(a)>N);
a=a*xx*(2*c-1)/(c*(2*c+1));
b=b+a; c=c+1;
end
b=b*2/sqrt(pi);
I'm not sure if my code is correct or how to only make it loop over n values and x values seperately.
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Loops and Conditional Statements dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!