MATLAB Answers

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

1 view (last 30 days)
Salah Djerouni
Salah Djerouni on 15 Feb 2020
Answered: darova on 15 Feb 2020
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

  0 Comments

Sign in to comment.

Answers (1)

darova
darova on 15 Feb 2020
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

  0 Comments

Sign in to comment.

Categories

Tags

Community Treasure Hunt

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

Start Hunting!