From: Daniel Robinson on
Need help with object oriented programming, I do not understand how it works at all, I know I'm supposed to set properties and then be able to vary those properties, but I have no idea how to do this. This is what I have so far:
"classdef racecar

properties
gear_ratios=[2.77 1.54 1 0.69]
p=[-6.4e-14 1.16e-10 -8.3e-8 2.9e-5 -5.5e-3 0.76 170]
differential_gear_ratio=4.266
radius=0.332
mass=1650
frontal_area=2.2
rolling_coefficient=0.009
drag_coefficient=0.32
end

methods

function self = racecar(g,po,d,r,m,f,rc,dc)

self.gear_ratios=g
self.p=po
self.differential_gear_ratio=d
self.radius=r
self.mass=m
self.frontal_area=f
self.rolling_coefficient=rc
self.drag_coefficient=dc

end
end
end"

I'm supposed to use the default parameters except mass=1500 to get a plot that I already have with mass=1650 from a different function file. Even if I figure out how to vary this mass, how would I run the old function file to give me a plot using the new mass??
I've asked help from so many people but they all seem to be terrible at explaining stuff to simple minded people like me i.e. this is my last resort
From: Nick on
I'm assuming that you've been given some function that plots some function of a racecar object. I'll call this function "racecar_plot". You need to:

1) Create a new racecar object:
"testcar = racecar();"
2) Change its mass
"testcar.mass = 1500;"
3) Plug it into the plotting function
"output = racecar_plot(racecar);"

You may also want to declare racecar a subclass of handle, as it looks like you're making an object that you would want to behave like a handle object.

GL