Finding volume using quad function

8 visualizaciones (últimos 30 días)
Amanda
Amanda el 7 de Abr. de 2011
This is the problem I have to solve. I keep getting an error message though and can't figure out what's wrong with it.
Find the volume of revolving the area of the circle(x-6)^2 +(y-7)^2 =5 about the x-axis.
R= 7+sqrt(5-(x-6)^2)
r= 7-sqrt(5-(x-6)^2)
Volume= quad('circle',(6-sqrt(5)),(6+sqrt(5)))
function [ z ] = circle( R, r )
z= pi(R.)^2 -pi(r.)^2
end
Any help would be great! Thanks
  2 comentarios
Andrew Newell
Andrew Newell el 7 de Abr. de 2011
There are lots of errors. Are you using the MATLAB editor? Put your mouse over any red line and you'll see some specific problems.
Amanda
Amanda el 7 de Abr. de 2011
Yes, I am. It doesn't say that there are errors until I run it.

Iniciar sesión para comentar.

Respuestas (2)

John D'Errico
John D'Errico el 7 de Abr. de 2011
You define a function called circle.
function [ z ] = circle( R, r )
R= 7+sqrt(5-(x-6)2)
r= 7-sqrt(5-(x-6)2)
z= pi(R.)2 -pi(r.)2
It has input arguments R and r. Then you try to define the variables R, r, both of which are functions of something called x. Where did x come from? Did you provide it as an input to circle? (No.) In fact, there is no need to pass in R and r into the function circle if you compute them inside the function!
Next, you don't seem to know matlab syntax. What does this mean:
(x-6)2
????? I think you wanted to square (x-6) ? If so, there IS an operator to raise a number to a power. Learn it. Use it.
At the end of circle, you try to define the output z.
z= pi(R.)2 -pi(r.)2
Again, I think you need to read the beginning matlab tutorials about basic syntax. This line has too many syntax errors in it to list.
  3 comentarios
Amanda
Amanda el 7 de Abr. de 2011
What value would I make x based off of how I'm revolving the equation of a circle around the x axis which makes a doughnut like shape?
Amanda
Amanda el 7 de Abr. de 2011
What value would I make x based off of how I'm revolving the equation of a circle around the x axis which makes a doughnut like shape?

Iniciar sesión para comentar.


Andrew Newell
Andrew Newell el 7 de Abr. de 2011

To follow up on a comment - if you are using a MATLAB editor, you should see something like this:

You will certainly have a red button on the right margin indicating errors. Mouse over the red lines and you will see details.

Also, most of John's comments still apply even after your changes - especially the one about reading some MATLAB tutorials.

  2 comentarios
Amanda
Amanda el 7 de Abr. de 2011
I know what the lines mean. The only thing it says is.. Terminate statement with semicolon to suppress output.
Amanda
Amanda el 7 de Abr. de 2011
What value would I make x based off of how I'm revolving the equation of a circle around the x axis which makes a doughnut like shape?

Iniciar sesión para comentar.

Categorías

Más información sobre Mathematics en Help Center y File Exchange.

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by