Passing a vector through a built in function?

Hello,
I am passing two vectors through and equation, but am getting a scalar output. The equation is as follows:
V=sqrt((2*W*cosd(theta))/(CL*p6000));
W and p6000 are constants.
theta and CL are vectors, of the same length.
When I run the code as is seen above, I get a scalar output instead of a vector. When I try to use the dot operator, i get an error saying matrix dimensions do not agree.
How do you fix this?
Thanks

 채택된 답변

Star Strider
Star Strider 2019년 11월 21일

0 개 추천

Do element-wise multiplication and division:
V=sqrt((2*W.*cosd(theta))./(CL*p6000));
See: Array vs. Matrix Operations for an extended discussion.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Mathematics에 대해 자세히 알아보기

태그

질문:

2019년 11월 21일

답변:

2019년 11월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by