Z must be a matrix, not a scalar or vector
3 ビュー (過去 30 日間)
古いコメントを表示
Hi guys
I need a 3D graphic for those 3 variables in specific. pitch, roll and Iest have the same size in this case columns of 54 values. I would appreciate if you can help me thank you very much
function[] = Stability (pitch, roll, Iest)
% pitch, roll and Iest (Data from WorkSpace)
[X,Y]= meshgrid(pitch,roll);
figure
subplot (2,2,1);
surf(X,Y,Iest);
axis([-50 50 -50 50 -0.2 1]);
ylabel ('Roll (°)');
xlabel ('Pitch (°)');
zlabel ('I. Estabilidad');
title ('Stability indexes');
end
% ERROR: "Z must be a matrix, not a scalar or vector"
5 件のコメント
採用された回答
madhan ravi
2018 年 9 月 14 日
編集済み: madhan ravi
2018 年 9 月 14 日
If pitch has (1X54) values and roll has the same values as pitch then Iest should have (54X54) values as a matrix.
pitch
roll
Iest=repmat(Iest,1,54)
function[] = Stability (pitch, roll, Iest)
% pitch, roll and Iest (Data from WorkSpace)
[X,Y]= meshgrid(pitch,roll);
figure
subplot (2,2,1);
surf(X,Y,Iest);
axis([-50 50 -50 50 -0.2 1]);
ylabel ('Roll (°)');
xlabel ('Pitch (°)');
zlabel ('I. Estabilidad');
title ('Stability indexes');
end
10 件のコメント
Stephen23
2018 年 9 月 14 日
@Alex Valero Mora: this "answer" does not actually deal with your scattered data. You should accept the answer that actually solves your problem, not just the first answer that comes along.
その他の回答 (1 件)
Walter Roberson
2018 年 9 月 14 日
function[] = Stability (pitch, roll, Iest)
pv = linspace(-50, 50);
rv = linspace(-50, 50);
Z = griddata(pitch, roll, Iest, pv.', rv);
surf(pv, rv, Z, 'edgecolor', 'none');
axis([-50 50 -50 50 -0.2 1]);
ylabel ('Roll (°)');
xlabel ('Pitch (°)');
zlabel ('I. Estabilidad');
title ('Stability indexes');
end
1 件のコメント
Walter Roberson
2018 年 9 月 14 日
Pitch = [
0
0
-10
0
10
10
-10
-10
0
0
-10
0
10
10
-10
0
0
-10
0
10
10
0
0
-10
0
10
10
0
0
-10
0
10
10
-10
-10
0
0
-10
0
10
10
-10
0
0
-10
0
10
10
0
0
-10
0
10
10
];
roll = [
0
-10
0
10
0
10
-10
10
0
-10
0
10
0
10
10
0
-10
0
10
0
10
0
-10
0
10
0
10
0
-10
0
10
0
10
-10
10
0
-10
0
10
0
10
10
0
-10
0
10
0
10
0
-10
0
10
0
10
];
Iest = [
0.989942340654644
0.802178238564791
0.796775799972624
0.803653845064710
0.821687183044870
0.791442057791294
0.777586416644017
0.782758864192040
0.774388293541222
0.552271140648203
0.555229986672985
0.782421186962462
0.760363307512461
0.906406097080077
0.546731674721163
0.583107483466789
0.569868655807287
0.323771406349666
0.575832238546995
0.723197675679337
0.716029101100372
0.748249261674753
0.784435878302803
0.563574908179280
0.553740850165316
0.735360868434881
0.544624923646681
0.419146617486797
0.419146617486797
0.419146617486797
0.419146617486797
0.538115608682760
0.523437658231029
0.419146617486797
0.419146617486797
0.575225929723435
0.576482226716369
0.361019236952593
0.419146617486797
0.554151574670287
0.419146617486797
0.352206741699065
0.773117436982731
0.592747054360200
0.570834362796000
0.594221698267574
0.631551981811119
0.581999337831112
0.585740340470783
0.419146617486797
0.354475826899071
0.575477558982328
0.575818380462714
0.715382090512770
];
Stability(Pitch, roll, Iest)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!