Why is it not taking the sqrt function, and how to fix it?

3 次查看(过去 30 天)
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 个评论
Stephen23
Stephen23 2021-8-31
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.

请先登录,再进行评论。

回答(1 个)

Wan Ji
Wan Ji 2021-8-31
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 个评论
Jeremy Reyes
Jeremy Reyes 2021-9-1
thank you, this made more sense because of the matrices of my datas were all in one column and row. This helped!

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Whos 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by