Effacer les filtres
Effacer les filtres

Matlab coding errors call when run..Please help to solve this problem

72 vues (au cours des 30 derniers jours)
FAKHRULRAZI
FAKHRULRAZI le 9 Jan 2023
%Ingredients
f = input('Enter your function: ');
df = input('Enter derivative of this function: ');
e = input('Enter tolerance: ');
x0 = input('Enter initial guess: ');
n = input('Enter no. of iteration: ');
%processing
if df(x0)~=0
for i=1:n
x1 = x0 - f(x0)/df(x0);
fprint ('x%d = %', 20f\n', i, x1)
if abs(x1-x0)<e
break
end
if df(x1)==0
disp('Newton raphson failed')
end x0 = x1;
end
end
  3 commentaires
Walter Roberson
Walter Roberson le 9 Jan 2023
apostrophe is not a valid character in a file name for a m file.

Connectez-vous pour commenter.

Réponses (1)

Gowthami
Gowthami le 18 Jan 2023
Hi,
It is my understanding that you are getting the error "MATLAB can only run a file with a valid name" while running a script.
As your script name contains an apostrophe, you are getting this error.
File names must start with a letter, and can contain letters, digits, or underscores.
More information on specifying the file name can be found here: https://in.mathworks.com/help/matlab/matlab_env/specify-file-names.html

Catégories

En savoir plus sur Entering Commands dans Help Center et File Exchange

Tags

Produits


Version

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by