MATLAB: 3D Printer Costs

3d printingenergy consumption

Could I get some help with a code for 3D printing costs?
I'm not good at this, but want to use MATLAB for my job on quoting 3D printing jobs.
I have a few perimeters to go off of and anything else that is needed I can provide.
Cost per roll of filament is $20.32 and has roughly 322 meters per roll.
9.3 cents per kWh of power consumption. It uses 240 watts while running.
The print takes 1hr and 45 minutes and the volume is 3.848 inches cubed.
I will use 10% infill for this particular part.
I'm not sure where to start, but have some experience with MATLAB. I just want it done the easy way so I can use it for quoting jobs.

Best Answer

Honestly, this is something more easily written using a spreadsheet. They are perfect for such an application.
Fill out the half dozen fields that contain the information you need. You put in the information, and see a result at the bottom. Using MATLAB for the problem seems to be a case of using a Mack truck to carry a pea to Boston. That said by someone who is often a strong advocate for MATLAB.
Where needed, spreadsheets offer a solver. So any formula you would write will be just as easily written in a spreadsheet cell. Yes, you could write a livescript, where you provide some variables, and it dumps out a result. But that is using a tool with a lot of capability to multiply two inputs together, so cost per hour times the time needed to run a job. Again - perfect for a spreadsheet.
I think your biggest problem will be to write down the relations describing the cost, since you seem to be a little vague there. But MATLAB will not help you in that respect. You need to know the mathematics of your problem before you write any code anyway. You can even have a spreadsheet online, so you could post a spreadsheet, and then access it from any location.
What I would do is write out everything - on paper. How is everything related to everything else? What do you need to know? Once you can see that, now I would ask if a spreadsheet is not able to do this directly.