Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

I have an Equation with all known constants. Except one variable changes from 500 to 1000 in an increment of 100 (so it can be a vector) how can I solve this equation for each value from 500 to 1000?

조회 수: 1 (최근 30일)
Here is the Equation:
Vground = sqrt(m/(RH+H)) * (RH/(RH+H))
m, and RH are known constants
now the H has multiple values ranges from 500 to 1000 in steps of 100 so H can be a vector [500:100:1000]
Now how can I solve the equation Vground with the vector H??

답변 (1개)

James Tursa
James Tursa 2016년 10월 7일
Use the element-wise version of the operators which begins with a period. E.g.,
m = whatever
RH = whatever
H = 500:100:1000;
Vground = sqrt(m ./ (RH+H)) .* (RH ./ (RH+H));
  댓글 수: 2
Mohammad Edaibat
Mohammad Edaibat 2016년 10월 7일
Thanks alot James that worked. However, In my code something else didnt work
I have another equation with similar situation I tried the .* and ./ and its not working here its
EPD = (((H.*1000) .* Lambda) ./ (Q .* GSD)) H is the same vector H = 500:100:1000 Lambda is a constant Q is also a vecot = 0.2:0.1:2 GSD is a constant
I think because I have two vectors its not working
Any Ideas?
James Tursa
James Tursa 2016년 10월 7일
This won't work because H and Q are not the same size. I.e., numel(H) is not the same as numel(Q), so you can't do element-wise operations with them because the elements don't match up spot for spot.
How you fix this depends on what you are trying to do. Should Q have the same number of elements as H? Or are you trying to get results for every possible combination of the H's and Q's that you currently have?

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by