I need help with MATLAB programming. The following code graphs a ellipsoid and a line. I need to create a line that is perpendicular to the H line and tangent to the ellipsoid. I also need to plot it in the graph. Can you help me with that?   % Initial Conditions w = 3; beta = deg2rad(45); I = [150; 400; 400]; w_NU = w*[cos(beta); 0; -sin(beta)] H_NU = [I(1)*w_NU(1); I(2)*w_NU(2); I(3)*w_NU(3)] T = (0.5)*dot(w_NU,H_NU); scal_c = sqrt(2*T); a = I(1)^(-1/2) * scal_c b = I(2)^(-1/2) * scal_c c = I(3)^(-1/2) * scal_c   figure; [x, y, z] = ellipsoid(0, 0, 0, a, b, c); h2 = surf(x, y, z,'FaceColor', [0.8500 0.3250 0.0980]); hold on   % Plotting Angular Momentum vector plot3([0 (H_NU(1)/200)], [0 0], [0 (H_NU(3)/200)], 'k', 'Linewidth', 2) text(1.7, 0, -4.5, '$$\bar{H}$$', 'Interpreter', 'latex', 'Color', 'k', 'FontSize',14); quiver3(H_NU(1)/200, 0, H_NU(3)/200, 0.01, 0, -0.01, 'k', 'LineWidth', 8); alpha(h2, 0.5);  view(0, 0); zlim([-5 5]); hold off

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

I need help with MATLAB programming. The following code graphs a ellipsoid and a line. I need to create a line that is perpendicular to the H line and tangent to the ellipsoid. I also need to plot it in the graph. Can you help me with that?

 

% Initial Conditions
w = 3;
beta = deg2rad(45);
I = [150; 400; 400];


w_NU = w*[cos(beta); 0; -sin(beta)]
H_NU = [I(1)*w_NU(1); I(2)*w_NU(2); I(3)*w_NU(3)]
T = (0.5)*dot(w_NU,H_NU);
scal_c = sqrt(2*T);

a = I(1)^(-1/2) * scal_c
b = I(2)^(-1/2) * scal_c
c = I(3)^(-1/2) * scal_c

 


figure;
[x, y, z] = ellipsoid(0, 0, 0, a, b, c);
h2 = surf(x, y, z,'FaceColor', [0.8500 0.3250 0.0980]);
hold on

 

% Plotting Angular Momentum vector
plot3([0 (H_NU(1)/200)], [0 0], [0 (H_NU(3)/200)], 'k', 'Linewidth', 2)

text(1.7, 0, -4.5, '$$\bar{H}$$', 'Interpreter', 'latex', 'Color', 'k', 'FontSize',14);
quiver3(H_NU(1)/200, 0, H_NU(3)/200, 0.01, 0, -0.01, 'k', 'LineWidth', 8);

alpha(h2, 0.5); 
view(0, 0);
zlim([-5 5]);
hold off

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 3 images

Blurred answer
Knowledge Booster
Processes of 3D Graphics
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education