Info
この質問は閉じられています。 編集または回答するには再度開いてください。
how to run the simulink block four times ie., for four different conditions using for loop?
1 回表示 (過去 30 日間)
古いコメントを表示
Hi,
I need to run my Simulink model for four times as I have assigned four conditions. Please find the code below.
k_A_index=[1.00 1.00 1.00 1.00];
k_S_index=[0.40 0.40 0.40 0.40];
mu_0_index=[0.55 0.30 0.06 0.03];
A_index=[0.40 0.40 0.40 0.40];
B_index=[0.60 0.20 0.20 0.10];
randomIndex = 1;
for randomIndex = 1:4
k_A = k_A_index(randomIndex);
k_A_dry=k_A
k_S = k_S_index(randomIndex);
k_S_dry=k_S
mu_0 = mu_0_index(randomIndex);
mu_0_dry=mu_0
A = A_index(randomIndex);
A_dry=A
B = B_index(randomIndex);
B_dry=B
s_x_index = 0:0.0001:0.02;
for i = 1:length(s_x_index)
x_a(i) = s_x_index(i);
epsilon_x=1/4.*[(G.*pi.*a1.*b1.*c_11.*s_x_index)/(Q.*mu)];
F=(2*Q*mu/pi).*[(k_A*epsilon_x)./(1+(k_A*epsilon_x).^2)+atan(k_S*epsilon_x)];
f_x = F/Q
f_x_save(randomIndex,:) = f_x;
end
end
%-----Run the Simulink model-----------------------------------------------
sim Single_wheelset_susp_mass_modifiedMW
x=[0,1,1,5];
y=[0,0,d,d];
figure(6);
cs = {'--b'; '-.g'; '-r'; '--.k'};
for k = 1:4
plot(t_plot,simout(:,1),cs{k});hold all;
grid on;
xlabel('Time (s)');ylabel('Wheelset lateral position (m)');
hold on;
end
hold off
legend('Dry','Wet','Low','VLow')
I have been working on this for a couple of days but couldn't get it still.Can anyone please help?
Thanks
3 件のコメント
Kaustubha Govind
2014 年 8 月 27 日
Which of these variables are used to parameterize the Simulink model?
回答 (0 件)
この質問は閉じられています。
参考
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!