Question: Now repeat the process on a different data set that potentially has different system parameters ( n 1 , d 3 d 2 and d
Now repeat the process on a different data set that potentially has different system
parameters n d d and d Read the SEAspeed.csv data and repeat Tasks and for this
data. Record your estimated parameter values.
i need help doing this. Define a function to compute the step response error for given parameters
function err costfunctionparams SEAtime, SEAspeed
N params;
D params;
D params;
D params;
Define the transfer function based on these parameters
s tfs;
TFspeed N ss D s D s D s;
Simulate the response to a V step input
y ~ step TFspeed, SEAtime;
Compute the error sum of squared differences between simulated and actual
err sumy SEAspeed;
end
Initial guess for the parameters based on "near" values
initialguess ;
Load the experimental speed response data
loadSEAspeed.mat'; Loads SEAspeed and SEAtime
Perform parameter estimation using fminsearch
optparams fminsearch@params costfunctionparams SEAtime, SEAspeed initialguess;
Display the optimized parameters
dispEstimated Parameters:;
dispN numstroptparams;
dispD numstroptparams;
dispD numstroptparams;
dispD numstroptparams;
Now simulate the response using the optimized parameters and plot the result
Nopt optparams;
Dopt optparams;
Dopt optparams;
Dopt optparams;
Define the optimized transfer function
s tfs;
TFspeedopt Nopt ss Dopt s Dopt s Dopt s;
Simulate the system's response with optimized parameters
y Task : Comparing Step Responses
s tfs;
TFspeedopt Nopt ss Dopt s Dopt s Dopt s;
Simulate the system's response with optimized parameters
yopt, topt step TFspeedopt, SEAtime;
Plot the optimized response and experimental data
figure;
plottopt, yopt, r 'LineWidth', ; Optimized response in red
hold on;
plotSEAtime, SEAspeed, b 'LineWidth', ; Experimental data in blue dashed line
legendOptimized Simulated Response', 'Experimental Data';
xlabelTime s;
ylabelSpeed rads;
titleComparison of Optimized Simulated Response and Experimental Data';
grid on;
Plot the response from Task for comparison
Redefine the near system transfer function
TFspeednear N ss D s D s D s;
Simulate the response for the near system
ynear, tnear step TFspeednear, SEAtime;
Plot the near system response
figure;
plottnear, ynear, g 'LineWidth', ; Near system response in green
hold on;
plotSEAtime, SEAspeed, b 'LineWidth', ; Experimental data in blue dashed line
plottopt, yopt, r 'LineWidth', ; Optimized response in red
legendNear System Response', 'Experimental Data', 'Optimized Simulated Response';
xlabelTime s;
ylabelSpeed rads;
titleComparison of Near System, Optimized Simulated Response, and Experimental Data';
grid on;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
