This is the error it returns: You cannot get the 't' property of Planet.
Error in Problem4dot10 (line 12) name=mercury.t(mercury);
I created getter functions to return properties of the class planet:
methods %for getter functions
function t=get.t(obj)
t=obj.t;
end
function r=get.r(obj)
r=obj.r;
end
function x=get.x(obj)
x=obj.x;
end
function y=get.y(obj)
y=obj.y;
end
function vx=get.vx(obj)
vx=obj.vx;
end
function vy=get.vy(obj)
vy=obj.vy;
end
function n=get.n(obj)
n=obj.n;
end
function n=get.Name(obj)
n=obj.Name;
end
end
And I called the getter from the file Problem4dot10.m:
mercury=Planet(1,0.002,0,2*pi,1,0,'Mercury');
mercury.sett(60);
name=mercury.t(mercury);
I looked at the documentation to try to figure out it out. What I'm trying to do is create a planet class that keeps track of the position of the planet, and also calculates where the planet is in the next time step. It then assumes that new state.