I need to save result of three loops in same file data if you possible for plot graphs or curves in 3D ?

조회 수: 1 (최근 30일)
Hi freinds ,
I have some with Matlab I want to save a result in same file data or data file but I have three loops with (for )
can you help me for do that ?
thanks.
this is my example :
for mass_ratio =0.01:0.01:0.1 it means this vector has (10 element)
for frequency_tuning=0.85:0.1:1.15 it means this vector has (4 element)
for damping_ratio=0.01:0.01:0.2 it means this vector has (20 element)
%result %
displacement
acceleration
end
end
end

답변 (1개)

darova
darova 2020년 2월 15일
example
mass_ratio = 0.01:0.01:0.1;
frequency_tuning = 0.85:0.1:1.15;
damping_ratio = 0.01:0.01:0.2;
displacement = zeros( length(mass_ratio),length(frequency_tuning), length(damping_ratio) );
acceleration = zeros( length(mass_ratio),length(frequency_tuning), length(damping_ratio) );
for i = 1:length(mass_ratio) %it means this vector has (10 element)
for j = 1:length(frequency_tuning) %it means this vector has (4 element)
for k = 1:length(damping_ratio) %it means this vector has (20 element)
%result %
displacement(i,j,k) = ...
acceleration(i,j,k) = ...
end
end
end
save data displacement acceleration

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by