필터 지우기
필터 지우기

How to evaluate and plot a set of equations with multiple points for a specific variable

조회 수: 2 (최근 30일)
I have RE = V*D/NU and another equation C = 3.*RHOBAR/(4.*D) both variables RE and C appear in other equations, which will eventually end up in a plot. I want set multiple values for D. How do I solve this? As of right now I only have D=.01 but I would like to include 5 more values. Is there a way to set this up with making D a matrix, for example D=[.01 .05]
Attached is pdf that has the code of the 2 files that are used to plot.

채택된 답변

Joost
Joost 2016년 9월 7일
편집: Joost 2016년 9월 7일
In the equation C = 3.*RHOBAR/(4.*D) you use element-wise multiplication (.*) but the division is not element-wise. If you turn the / in a ./ then you can use a vector for D and get the same number of elements in C.
Possibly you need to use element-wise multiplication and division in the equation for RE as well, that is dependent on the application and domain.
I noticed in your pdf file a potentially dangerous thing: equal comparison with doubles ( if R==0 ). (note that 0.5-0.4-0.1 == 0 returns false in Matlab due to numerical significance issues.) It is better to use tolerances in the comparison.
  댓글 수: 2
aquiano
aquiano 2016년 9월 7일
Do you have any suggestions on how to fix that part of the code (R==0)? The parts below it a are showing an error for(&&). Thanks any help would be appreciated

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by