How can I solve this error : Invalid text character. Check for unsupported symbol, invisible character, or pasting of non-ASCII characters.

11 vues (au cours des 30 derniers jours)
n=input('donner le nombre de points') k=0; for i=1:n u1=rand;u2=rand; x=2*u1; y=2*u2; if(y<=[(4*x)/(x^2 +1)]-[x*(x-12)]) k=k+1; end end Surface = k/n;

Réponses (1)

Alan Stevens
Alan Stevens le 14 Mar 2022
This works for me:
n=input('donner le nombre de points: ');
k=0;
for i=1:n
u1=rand;u2=rand;
x=2*u1;
y=2*u2;
if(y<=[(4*x)/(x^2 +1)]-[x*(x-12)])
k=k+1;
end
end
Surface = k/n;
disp(Surface)

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by