function [r,v,T] = simpleorbit
% Executes the 2D Earth orbit integration around Sun with 2 bodies
% equations
% Orbit parameters:
e = 0.0167; % Orbit eccentricity
mu_S = 132712439935.5; % Sun parameter (Km^3/s^2)
R_S = 6.957*10^5; % Sun radius (Km)
a = 149.6*1e6; %Semimajor axis (Km)
theta0 = 0;
% Time
T = 2*pi*sqrt(a^3/mu_S);
tfin = T;
% IC:
rx0 = a*(1-e^2)/(1+e*cos(theta0));
vy0 = sqrt(2*mu_S/rx0-mu_S/a);
X0 = [rx0,0,0,0,vy0,0];
options = odeset('Reltol',1e-15,'AbsTol',1e-15);
% Integration:
[T, X] = ode113(@dynamics, [0,tfin], X0, options, mu_S);
r = [X(:,1),X(:,2),X(:,3)];
v = [X(:,4),X(:,5),X(:,6)];
% Additional results:
h = cross(r,v);
ev = cross(v(1,:),h(1,:))/mu_S-r(1,:)/norm(r(1,:));
% Draw planet
figure
[sx,sy,sz] = sphere(100);
surf(R_S*sx,R_S*sy,R_S*sz,'EdgeColor','none','FaceColor','y')
% Aspect
hold on
axis equal
grid on
axis([-2*a,2*a,-2*a,2*a,-2*R_S,2*R_S])
% Plot:
% quiver3(0,0,0,h(1,1),h(1,2),h(1,3))
quiver3(0,0,0,ev(1),ev(2),ev(3))
comet3(r(:,1),r(:,2),r(:,3))
quiver3(r(1:10:end,1),r(1:10:end,2),r(1:10:end,3),v(1:10:end,1),v(1:10:end,2),v(1:10:end,3))
end
function [dX] = dynamics(~,X,mu)
rx = X(1);
ry = X(2);
rz = X(3);
vx = X(4);
vy = X(5);
vz = X(6);
r = sqrt(rx.^2+ry.^2+rz.^2);
dX(1,1) = vx;
dX(2,1) = vy;
dX(3,1) = vz;
dX(4,1) = -mu*rx/r.^3;
dX(5,1) = -mu*ry/r.^3;
dX(6,1) = -mu*rz/r.^3;
end
write a matlab script to use the verlet-stormer algorithm to model satelite motion.(gravity)
write a matlab script to use the verlet-stormer algorithm to model satelite motion.(gravity)
In matlab script, thank you! Write a MATLAB script that will generate random integers in the range from 1 to 100, and print them, until one is finally generated that is greater than 50. The script should print how many attempts it took
Write a MATLAB script to plot the function of f(x) given by: Write a MATLAB script to plot the function of f(x) given by: f(x) = integral x^2 - pi^2/4 x > pi/2 8 * cos x -pi/2 lessthanorequalto x lessthanorequalto pi/2 pi^2/4 - x^2 x < -pi/2
matlab script QUESTION 1 (1) Write a MATLAB script to find the standard deviation of integer numbers located in the vector a. Note that the vector contains both integer and floating- point numbers. The standard deviation formula is: 1 S = VN-12(%; – T)? use a-[6.6, 3, 8, 5, 8.8, 54, 78, 90, 5.5] the result should be
Write a MATLAB script that loads and displays each of the captured images. Publish the MATLAB script output as a .docx file. For compactness purposes, show all five waveforms for each case on the same figure using MATLAB subplots. Use the legend function in MATLAB to add appropriate labeling to the subplots to ensure that the Figure legend can be written succinctly.
Write a matlab script(using only matlab) for this. Write a script to solve the following problem: Ask the user for the length and the width of a rectangle. These need to be passed to a function. The function is to calculate and return the area and the perimeter of the rectangle. The area is the length times the width and the perimeter is 2 times the length and 2 times the width. Make sure to suppress all output from the...
Use matlab and write script: Please use n = input('Enter the value of n :') not the function command. Consider the following equation 6a + 9b + 20c = n The variables a, b, and c can be thought of as the number (non-negative integers) of 6’s, 9’s, and 20’s in n. Note that for a given n, there might be one, multiple, or no solutions for a, b, and c. For example, n = 15 → a = 1...
Solving digital system problems using MATLAB Write a MATLAB script CTask2p3.m to: a) Generate the truth table for the following Boolean expressions and display it in the MATLAB command window (Use logical functions: and, not, or)
write matlab script 5. Use a for loop to sum the elements in x = [1 2 3 4 5] Check your answer with sum function 6. Use a while loop to sum the elements in x = [1 2 3 4 5] Check your answer with sum function
Write a well-documented MATLAB script that verifies the Central Limit Theorem based on uniform distribution. Write a MATLAB script that would allow you to specify n and k where n is the sample size and k is the number of times that you repeat this experiment (to obtain the distribution that you will compare with the normal distribution). Use n = 10; 000 and k = 1; 000. The result of the script should be the histogram for the probability...