how can I Compute the value of d for the following values of x , Outcome equation d=((34.63/x)-5.126)/2.54
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Is my code right i am beginner in matlab.
>>clc
>>clear
for x=[0.1000,0.1500,0.2000]
fprintf("\n\t%g\n",x)
else d=((34.63/x)-5.126)/2.54
disp ("ANSWER")
end
"OUTCOME WANTED RESULT "
0 Commenti
Risposte (2)
DGM
il 15 Apr 2021
Modificato: DGM
il 15 Apr 2021
I have no idea what that code is intended to do, but if you just want to evaluate the expression all x:
x=[0.1000,0.1500,0.2000]
d=((34.63./x)-5.126)/2.54
I guess if you're trying to get it to display formatted results to console, you could do that as well.
for l=1:numel(x)
fprintf('\t%g\t%g\n',x(l),d(l))
end
7 Commenti
Steven Lord
il 15 Apr 2021
Every time this line of code executes:
answer=[x' d']
it assigns a value to the variable named answer then displays the contents of that variable. If you just want to assign a value to the variable but not display it, end the line of code with a semicolon.
answer=[x' d'];
Then if you want to display it at the end of the code you can.
disp(answer) % or just plain
answer
VBBV
il 15 Apr 2021
Modificato: VBBV
il 15 Apr 2021
%true
d = [];
for x=[0.1000,0.1500,0.2000]
d=[d ((34.63/x)-5.126)/2.54];
disp ("ANSWER");
end
x=[0.1000 0.1500 0.2000];
fprintf("\t%4g\t\t%4g\n",[x;d])
Vedere anche
Categorie
Scopri di più su Creating and Concatenating Matrices in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!