Why is it not taking the sqrt function, and how to fix it?
Mostrar comentarios más antiguos
U = (sqrt(s)/n)*(BH./B+2.*H).^2/3;
I am not sure why it is not taking sqrt. Is it a problem with the 's' data, or how i wrote the formula?

1 comentario
Stephen23
el 31 de Ag. de 2021
Rather than fiddling around with strings (e.g. using STR2NUM) the best solution by far would be to import your numeric data properly. If you upload your data file by clicking the paperclip button then someone can show you how.
Respuestas (1)
Wan Ji
el 31 de Ag. de 2021
You should transform char format to double then do your work
B = str2num(B);
H = str2num(H);
n = str2num(n);
s = str2num(s);
U = (sqrt(s)./n).*(B.*H./B+2*H).^2/3;
1 comentario
Jeremy Reyes
el 1 de Sept. de 2021
Categorías
Más información sobre Whos en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!