フィルターのクリア

Plotting subplots in a for loop

2 ビュー (過去 30 日間)
Christina Reid
Christina Reid 2021 年 1 月 4 日
コメント済み: Christina Reid 2021 年 1 月 4 日
Hello! I am currently trying to work on something that I believe is very simple, but can't seem to get it. I have 4 different .mat files that have 4 different FRF's that are stored as strucutres. I am able to pull each y_value from each structure and plot the abs for each FRF. I would LOVE for the script to pull each y_value from each .mat file and then plot the 4 different abs of the FRF on one figure (in a clean way - where the peak's for each FRF is clearly defined), with a different color for each FRF. When I tried it this way, the figure was a mess, and decided to have one figure with 4 subplots for each FRF, however I am having an issue coding that part.
Here is what I have so far and attached are the .mat files:
clear all
clc
%% Rubber Material at different nodes
data1 = importdata ('acc_1_rubber.mat');
data2 = importdata ('acc_2_rubber.mat');
data3 = importdata ('acc_3_rubber.mat');
data4 = importdata ('acc_4_rubber.mat');
data_all = [data1; data2; data3;data4];
for i = 1:length(data_all)
FRF{i} = data_all(i).y_values.values;
figure(1)
subplot(i,1,i)
plot(abs(FRF{i}(i,:)));
end

採用された回答

VBBV
VBBV 2021 年 1 月 4 日
編集済み: VBBV 2021 年 1 月 4 日
clear all
clc
%% Rubber Material at different nodes
data1 = importdata ('acc_1_rubber.mat');
data2 = importdata ('acc_2_rubber.mat');
data3 = importdata ('acc_3_rubber.mat');
data4 = importdata ('acc_4_rubber.mat');
data_all = [data1; data2; data3;data4];
K = length(data1.y_values.values)
for i = 1:length(data_all)
FRF{i} = data_all(i).y_values.values;
figure(1)
subplot(length(data_all),1,i)
plot(abs(FRF{i}(1:K,:)));
end
  1 件のコメント
Christina Reid
Christina Reid 2021 年 1 月 4 日
Thank you!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Import and Analysis についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by