Why is it not taking the sqrt function, and how to fix it?
조회 수: 7 (최근 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?![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/725374/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/725374/image.png)
댓글 수: 1
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
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;
참고 항목
카테고리
Help Center 및 File Exchange에서 Whos에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!