got error in input arguments (line7) x1=P1(1);y1=P1(2);M1=P1(3);theta1=P1(4);
3 次查看(过去 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!