The solution to this involves the monte carlo capabilities available using the command line with your Simulink model and the use of the VERTCAT function to concatenate the data after each run. The following example code uses the vdp demo model to demonstrate. For more information on the VERTCAT function, please type the following at the MATLAB command window prompt:
help vertcat
PLEASE NOTE: You first need to edit the vdp model by going to the Simulation menu and choosing Simulation Parameters-->Workspace I/O pane. Then check the Time and Output boxes.
% Initialize start and stop time as well as the time and output start = 0; stop = 10; time = []; output = []; for i = 1:10 % Simulate the model and save the data by concatenating it [t,state,y] = sim('test_vdp',[start stop]); start = stop; stop = stop + 10; % Concatenate the previous data with the new data % This will cause the end point to overlap (repeat), but is harmless % as you can tell from the results (data is the same) time = vertcat(time,t); output = vertcat(output,y); end plot(time,output) % Clear the data from the script clear i start stop t y state
For more information on running a simulation from the command line, please refer to the Simulink documentation opened when you enter the following command at the MATLAB command prompt:
web([docroot,'/toolbox/simulink/ug/simulation28.html'])
Matlabsolutions.com provides guaranteed satisfaction with a
commitment to complete the work within time. Combined with our meticulous work ethics and extensive domain
experience, We are the ideal partner for all your homework/assignment needs. We pledge to provide 24*7 support
to dissolve all your academic doubts. We are composed of 300+ esteemed Matlab and other experts who have been
empanelled after extensive research and quality check.
Matlabsolutions.com provides undivided attention to each Matlab
assignment order with a methodical approach to solution. Our network span is not restricted to US, UK and Australia rather extends to countries like Singapore, Canada and UAE. Our Matlab assignment help services
include Image Processing Assignments, Electrical Engineering Assignments, Matlab homework help, Matlab Research Paper help, Matlab Simulink help. Get your work
done at the best price in industry.