Info
此问题已关闭。 请重新打开它进行编辑或回答。
help with area and volume cyclinder?
1 次查看(过去 30 天)
显示 更早的评论
Write a function to compute the area and volume of a cylinder. The first line is function [area, volume] = cylinder(height, radius)
Perform the following tests in the Command window:
>> [a, v] = cylinder(1, 1)
>> cylinder(1, 1)
1 个评论
回答(2 个)
Star Strider
2014-12-6
First, write down the formulae for the surface and volume of a cylinder, calculate their values from some data you’re given, then tell MATLAB to do exactly the same thing. Check your calculations with the values MATLAB produces to be sure you’ve told MATLAB how to do the calculations correctly.
See Function Basics for help with writing your function. (I would use anonymous functions — they’re easy for problems such as this — unless you’re supposed to use function files.)
0 个评论
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!