Error using plotv "too many input arguments"
Show older comments
I'm trying to generate a plot using these inputs:
% Particle 1
m1 = 1;
V1 = [2*cosd(45); -2*sind(45)];
% Particle 2
m2 = 2;
V2 = [cosd(45); sind(45)];
% Conservation of momentum and kinetic energy
Vcm = (m1*V1+m2*V2)/(m1+m2);
Vr = V1-V2;
Vrmag = norm(Vr);
Vr_starmag = Vrmag;
x = 0:30:360;
Vr_star = [Vrmag*sind(x); Vrmag*cosd(x)];
%% Outgoing velocity vectors
V1_star = Vcm+(m2/(m1+m2))*Vr_star;
V2_star = Vcm-(m1/(m1+m2))*Vr_star;
figure(1)
plot(V1,'r')
hold on
plot(V2,'b')
plotv(V1_star,'Color',[245/255 121/255 12/255])
plotv(V2_star,'g')
hold off
title('Collision results')
legend('C1','C2','C1^*','C2^*')
xlabel('X')
ylabel('Y')
V1_star and V2_star are both 2x13 matrices while V1 and V2 are both 2x1.
I need orange lines for V1_star so I used the rgb triplet code for orange. When I do this, I get the "too many input arguments". Is there better syntax for this or does plotv not recognize the rgb code? Thanks
Note:
plotv(V2_star,'g')
Returns the correct graph. Therefore it must be a formatting issue.
Accepted Answer
More Answers (0)
Categories
Find more on Entering Commands in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!