'Matrix dimensions must agree' error.

조회 수: 8 (최근 30일)
Furkan Yürümez
Furkan Yürümez 2020년 5월 20일
댓글: Furkan Yürümez 2020년 5월 20일
% Hello guys, I am trying to do this problem, but ı get matrix dimensions must agree error. Can you please help me with that?
p=1.225;
p2=[1.225;0.7364;0.4135];
g=9.81;
s=845;
cd0=0.0163;
ar=7.53;
e=0.74;
k=1/(pi*e*ar);
w=540000*g;
clmax=2.6;
v_stall=sqrt((2*w)/(p2*s*clmax));
v=v_stall:700;
D0=0.5*p2*v.^2*s*cd0;
Di=(2*k*w^2)./(p2*v.^2*s);
D=D0+Di;
P=D.*v;

채택된 답변

Walter Roberson
Walter Roberson 2020년 5월 20일
p = 1.225;
p2 = [1.225; 0.7364; 0.4135];
num_p2 = length(p2);
g = 9.81;
s = 845;
cd0 = 0.0163;
ar = 7.53;
e = 0.74;
k = 1/(pi*e*ar);
w = 540000*g;
clmax = 2.6;
v_stall = sqrt((2*w)./(p2*s*clmax));
v = cell(num_p2, 1);
P = cell(num_p2, 1);
for K = 1 : num_p2
v{K} = v_stall(K) : 700;
D0 = 0.5 * p2(K) .* v{K}.^2 .*s .* cd0;
Di = (2 .* k .* w.^2) ./ (p2(K) .* v{K}.^2*s);
D = D0 + Di;
P{K} = D .* v{K};
end
temp = [v,P].';
plot(temp{:});
legend( string(p2) );

추가 답변 (0개)

카테고리

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

제품


릴리스

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by