plot3でのエラー解決方法
19 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
二次元plotまでは,できるのですが,plot3を用いて3次元グラフを書こうとすると
ベクトルは同じ長さでなければなりません.というエラーが出ます.
どのように書けば,これを回避することが可能でしょうか?
function [ output_args ] = transient_StateSpace( )
cKeyName = 'sol109_InitalVelo_beam10_alminum';
RespGrid = 11;
RespDir = 2;
src = load([cKeyName, '.mat']);
bdf = src.bdf;
A = src.A;
ActiveADispIdx = src.ActiveADispIdx(:)';
ActiveAVeloIdx = src.ActiveAVeloIdx(:)';
ActiveAIdx = [ActiveADispIdx(:); ActiveAVeloIdx(:)]';
NN = size(bdf.BulkData.grids, 1);
dof = 6*NN;
tstep = get_tstepsub(bdf.CaseCtrl.tstep, bdf.BulkData);
iNumStep = tstep(2);
dt = tstep(3);
if abs(src.dt - dt) > eps
error('Unknown Error');
end
% dt = (1/EigenFreq(end))/10;
t = 0:dt:dt*(iNumStep - 1);
% % Initial condition
[U0, V0] = mk_InitialCondition(bdf.CaseCtrl.ic, bdf.BulkData);
X = zeros(2*dof, iNumStep);
X( 1: dof, 1) = V0;
X((dof + 1):2*dof, 1) = U0;
% solve
A0 = A(ActiveAIdx, ActiveAIdx);
for ii1 = 1:(iNumStep - 1)
X(ActiveAIdx, ii1 + 1) = A0*X(ActiveAIdx, ii1);
end
% convolution
F = 5*cos(7*t);
conv_X = zeros(2*dof, iNumStep);
tic
for ii1 = 1:iNumStep
conv_S = X(ActiveAIdx, :)*F(1,ii1);
conv_X(ActiveAIdx, ii1:end) = conv_X(ActiveAIdx, ii1:end) + conv_S(:, 1:(iNumStep - ii1 + 1));
end
toc
%2次元グラフ
ActiveADispIdx = ActiveADispIdx(1:2:end);
figure(203);
plot(t,conv_X(ActiveADispIdx,:));
%問題箇所
figure();
for ii1 = 1:ActiveADispIdx
h1 = plot3(ones(19,1)*ii1*1,t(1:0.01:2),conv_X(ii1,:));
end
disp('finished')
このような2次元グラフを以下の様に表すにはどうすれば良いでしょうか.
0 commentaires
Réponses (1)
Akira Agata
le 17 Sep 2020
waterfall 関数を使って、ウォーターフォールプロットとして可視化するというのは如何でしょうか?
以下は簡単な例です。
% Sample data
t = 0:0.1:20;
data = zeros(7,numel(t));
for kk = 1:7
data(kk,:) = besselj(kk,t);
end
% Visualize as a waterfall plot
figure
waterfall(t,1:7,data)
xlabel('t')
ylabel('\nu')
title('Bessel function J_{\nu}(t)')
ax = gca;
ax.View = [15 60];
Voir également
Catégories
En savoir plus sur ライン プロット dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!