Simulink/Matlab Help with For loop
정보
이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.
이전 댓글 표시
So I have a model created called "HW1_M". In this model, I have variables such as x and y that are changing based on the value I assign it through the command window. I also have two constant values, F and m.
in my script file I am trying to create a for loop that will set the value of x and y, run the model, plot the output, and then change the values of x and y and re-run the model and provide a new figure with the new data.
I got the code to partially work except that when it runs, the values of x and y update, but the graphs don't. Both Figure 1 and Figure 2 are the same..
Any ideas on how to fix this. My code is provided below: w = [1,2]; m=10; F=1; %hold off; for wi = 1 k = 8; % spring constant B = 2; % Dampening Constant set_param('Problem_1_time_domain', 'SimulationCommand', 'start') %subplot (2,1,1) subplot (1,1,1) plot (x) title ('For k=8 and B=2') set_param ('HW1_M', 'SimulationCommand', 'stop') end;
for wi = 2 k = 4; % spring constant B = 1; % Dampening Constant set_param('HW1_M', 'SimulationCommand', 'start') subplot (2,1,2) plot (x) title ('For k=4 and B=1') set_param ('HW1_M', 'SimulationCommand', 'stop') end;
댓글 수: 0
답변 (0개)
이 질문은 마감되었습니다.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!