Recent content by Zoobie

  1. Z

    MATLAB How to Correct Syntax for a Distance Calculation Method in MatLab?

    I actually made some progress on it - I changed the parameters of the function to: function [dist] = distanceTo(obj,obj2) dist = sqrt(abs(obj.x-obj2.x)^2 + abs(obj.y - obj2.y)^2 + abs(obj.z + obj2.z)^2); end and typing in the same line returned the expected outcome. My question then turns to...
  2. Z

    MATLAB How to Correct Syntax for a Distance Calculation Method in MatLab?

    That's just the function code. There is also a constructor method: function p = planet(x_pos,y_pos,z_pos,x_vel,y_vel,z_vel,mass) p.x = x_pos; p.y = y_pos; p.z = z_pos; p.xV = x_vel; p.yV = y_vel; p.zV = z_vel...
  3. Z

    MATLAB How to Correct Syntax for a Distance Calculation Method in MatLab?

    I was tasked with creating a simple program to model the solar system using Matlab. One step in the way I wanted to do this was by making a "planet" class that stored the x,y,z position, and the x,y,z velocity. One of the methods, then, would be something to that took in another "planet"...
Back
Top