Question
Write a function ProjectionPlot that plots the vectors a = OA, b = OB, and c = OC, where c is the projection of a
Write a function ProjectionPlot that plots the vectors a = OA, b = OB, and c = OC, where c is the projection of a onto b
For your problem, A = (6,3), B = (3,6). All plots must be in the same figure in the order indicated in the function template. The projection vector cshould be plotted in the colour black, with a line thickness of 1. The vectors a and b do not require any customisation to line colour, thickness, etc.
The vector c may be calculated using MATLAB or by hand.
The function template is provided below.
function ProjectionPlot()
c = 0;
hold on
%insert plot of OA
%insert plot of OB
%insert plot of OC
hold off axis('equal')
end
This is what I have so far:
function c = ProjectionVector(a,b)
x = [0,2.4]; y = [0,4.8]; hold on c=(dot(a,b)./(norm(b)^2)).*b;
plotv(a); plotv(b); plotv(c,'k','LineWidth',1); hold off axis('equal') end
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started