The Matlab code from Assignment 2 is shown here: %%%%%%%%%%%%%%%%%%%%%%% sat_mod
ID: 2291713 • Letter: T
Question
The Matlab code from Assignment 2 is shown here:
%%%%%%%%%%%%%%%%%%%%%%% sat_model.m %%%%%%%%%%%%%%%%%%%%%%%
% states are:
% x1 = pointing angle (rad)
% x2 = angular velocity (rad/sec)
% x3 = wheel speed (rad/sec)
% inputs are: u = motor torque (Newton-meters)
% outputs are:
% theta = pointing angle (degrees)
% omega = wheel speed (rev/min)
% state-space equations used:
% xdot = A * x + B * u
% y = C * x
%%%%%%%%%%%%%%%%%%%%%%% sat_model.m %%%%%%%%%%%%%%%%%%%%%%%
clear; clc;
format short e % use floating point
% Satellite & reaction wheel, no controller
%
Js = 13.6; % satellite moment of inertia (kg m^2) Jw = 1.36e-4; % wheel moment of inertia (kg m^2)
B = 1.01e-6; % frictional coefficient (N m /(rad/sec))
Jeq = Js*Jw/(Js + Jw); % equivalent moment of inertia (kg m^2)
%
A = [0 1 0 ;
0 0 B/Js ;
0 0 -B/Jeq ];
%
B = [ 0 ; % gains for motor torque (internal)
-1/Js ; 1/Jeq ];
%
G = [0 ; % gains for external inputs 1/Js ;
-1/Js ];
%----- outputs are in degrees & rpm so need to convert C = [ 180/pi 0 0 ;
0 0 60/(2*pi) ];
%
D = zeros(2,1);
%
%----- transfer function matrix for motor input [num_mtr,den_mtr] = ss2tf(A,B,C,D);
%---- zero out any very small elements in numerator
% num_mtr(1,2) & num_mtr(1,4) --> 0 num_mtr = small20(num_mtr,1.0e-10);
%----- transfer function matrix for disturbance torque [num_dst,den_dst] = ss2tf(A,G,C,D);
%---- zero out any very small elements in numerator
2
% num_dst(1,2) & num_dst(1,4) --> 0 num_dst = small20(num_dst,1.0e-10);
%---- define time vector from 0 to 10 minutes t = [0:2:600]';
disp(' ')
disp('t = time vector from 0 to 10 minutes')
disp('.....You can use it with step, impulse, & lsim commands.') disp(' ')
% disp('*******>');pause
% may want to restore these for later use
save sat.mat A B C D G num_mtr den_mtr num_dst den_dst t
disp('G1(s): motor torque --> pointing angle') numG1 = num_mtr(1,:)
denG = den_mtr
G1 = tf(numG1,denG)
% disp('*******>');pause
%----- plot a step response figure(1);
taum = 1.0e-4*ones(size(t)); y = lsim(G1,taum,t); plot(t,y);grid
ylabel('degrees');xlabel('seconds')
title('Open-loop Model: pointing angle due to step motor torque of 1.0e-4 N-m')
load sat.mat % restore state-space matrices & G(s) disp('end of motor torque --> pointing angle')
Explanation / Answer
save sat.mat A B C D G num_mtr den_mtr num_dst den_dst t
thid line in the code is erroneaous and hence cannot be solved.
kindly provide the correct assignment code
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.