Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

How would I add a variable onto an image, and a specific spot on the image? This

ID: 3720230 • Letter: H

Question

How would I add a variable onto an image, and a specific spot on the image? This is for a MATLAB project on physics.

Here is what I have so far in my coding.

function [totalx,totaly,resultant]=forcesObject(object, mass, power, velocity, cofriction)

g=9.81;
mg=mass*g;

if power==0
totalx==0;
else
leftx= power./velocity;
rightx=cofriction.*mg;
end
leftx=reshape(leftx,[15,15]);
rightx=reshape(rightx,[15,15]);
mg=reshape(mg,[15,15]);

%object must be either car, bicycle, or person
switch object
case 'car'
totaly=mg;
totalx=(power./velocity)-cofriction*mg;
resultant= sqrt(((totaly).^2)+((totalx).^2))
a=uint8(leftx);
b=uint8(rightx);
c=uint8(mg);
d=imread('car.png');   
for i=1:3
e(:,:,i)=d(:,:,1+b);
end
imshow(e)
  
case 'bicycle'
totaly=mg;
totalx=(power./velocity)-cofriction*mg;
resultant= sqrt(((totaly).^2)+((totalx).^2))   
a=uint8(leftx);
b=uint8(rightx);
c=uint8(mg);
d=imread('bicycle.png');   
for i=1:3
e(:,:,i)=d(:,:,1)+a+b+c;
end
imshow(e)
  
case 'person'
totaly=mg;
totalx=(power./velocity)-cofriction*mg;
resultant= sqrt(((totaly).^2)+((totalx).^2))
a=uint8(leftx);
b=uint8(rightx);
c=uint8(mg);
d=imread('runner.png');   
for i=1:3
e(:,:,i)=d(:,:,1)+a+b+c;
end
imshow(e)
otherwise  
display='Error, not an option';
end
end

The image is for the car portion.

Explanation / Answer

Hey,

Try Using the XLABEL and YLABEL commad in the coding. As your grapgh is 2D and it has two axes I think these commands will be helpful.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote