¿Porque no corre mi código? No aparece nada

135 visualizzazioni (ultimi 30 giorni)
Le pongo en correr y no pasa nada
  1 Commento
the cyclist
the cyclist il 15 Apr 2021
Google-translated into English:
"Why is my code not running? Nothing appears."

Accedi per commentare.

Risposte (1)

Constantino Carlos Reyes-Aldasoro
Hola,
Primero unas recomendaciones:
1) te recomiendo escribir en ingles porque en espan~ol es mas dificil tener ayuda
2) te recomiendo usar codigo y no imagenes para que sea posible copiar tu problema directamente.
Ahora sobre tu problema, si copias el codigo directamente en el command window funciona:
>> A=[1 1.28; 1 0.66];
>> B=[0.88;1.14];
>> X=inv(A)*B
X =
1.4168
-0.4194
La parte siguiente tiene un error, que si tratas de correr te dira el error:
>> fprintf('La ecuacion es y=%fx+f',(X(2),X(1)))
fprintf('La ecuacion es y=%fx+f',(X(2),X(1)))
Error: Invalid expression. When
calling a function or indexing
a variable, use parentheses.
Otherwise, check for mismatched
delimiters.
Yo creo que estas tratando de seguir sintaxis de C en lugar de usar y escribir en sintaxis de Matlab:
>> disp(strcat('La ecuacion es y=',num2str(X(2)),'+',num2str(X(1))))
La ecuacion es y=-0.41935+1.4168
>>
Esto debe resolver tu problema. Si tienes mas dudas, dime, si no, por favor accepta la respuesta.
  4 Commenti
Constantino Carlos Reyes-Aldasoro
De nada! Si esto resuelve tu problema, por favor acepta la respuesta

Accedi per commentare.

Categorie

Scopri di più su Introduction to Installation and Licensing in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by