got error in input arguments (line7) x1=P1(1);y1=P1(2);M1=P1(3);theta1=P1(4);
조회 수: 2 (최근 30일)
이전 댓글 표시
function [P2]=moc_axispt(P1,g)
% function to evaluate 2-D MOC axis point from given upstream point.
% P1 is an array [x,y,M,theta] and the right charac is used to goto
% axis. Geometry is assumed to have y=0 at axis and we are solving the
% upper half domain
x1=P1(1);y1=P1(2);M1=P1(3);theta1=P1(4);
Nu1=PMangle(M1,g);
Mu1=180/pi*asin(1/M1);
theta2=0;
Nu2=Nu1+theta1;
M2=PM_Mach(Nu2,g);
y2=0;
x2=x1+(y2-y1)/tan(pi/180*(theta1-Mu1));
P2=[x2 y2 M2 theta2];
return
댓글 수: 0
답변 (1개)
Vatsal
2023년 9월 21일
편집: Vatsal
2023년 9월 29일
I understand that you are encountering an error related to the implementation of the “moc_axispt” function which evaluates the 2-D MOC axis point from the given upstream point.
As you have mentioned that you are getting the error In line 7 which is,
x1=P1(1); y1=P1(2); M1=P1(3); theta1=P1(4).
I ran the code in my system, and I am not getting an error on the line that you have mentioned (line 7), so I suggest that you check the input “P1” which you are passing as an argument in the function., Most likelyly the error you are encountering is likely because the input array “P1” does not have enough elements to extract those values, and for more clarity the “P1” array should have at least four elements for the code to work properly.
You can also refer to the MATLAB documentation for "Array Indexing" to obtain more information on its usage and syntax. The link is provided below:-
https://in.mathworks.com/help/matlab/math/array-indexing.html
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!