solving sin(x) by solve commad?
13 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
metin yilmaz
el 8 de Nov. de 2020
Comentada: John D'Errico
el 9 de Nov. de 2020
When I write this command solve(sin(x)), why is the result 0? What is the meaning of this operation? Can I solve it for 0:10?
Thank you.
0 comentarios
Respuesta aceptada
John D'Errico
el 8 de Nov. de 2020
Editada: John D'Errico
el 8 de Nov. de 2020
Um, is it not true that sin(0) == 0? You ask why? It happens to be the correct answer. At least, A correct answer. And since there are infinitely many solutions to the question posed, it is difficult to list them all. However, if you wish to push solve to give you the complete set of solutions, you can do so in parametric form.
syms x
xsol = solve(sin(x) == 0,x,'returnconditions',true)
xsol.x
xsol.conditions
So solve tells us that pi*k is a solution for integer k.
I have no idea what your question at the end means: "Can I solve it for 0:10?"
Yes, you can solve whatever you want, but until I know what you are asking, I have no clue how to solve what is in your mind. The crystal ball is too foggy.
6 comentarios
John D'Errico
el 9 de Nov. de 2020
Those are valid questions, but they are wildly off-topic in this question. A question should not become a running tutoring session though. So if you have a question that you cannot understand about a function, then ask it as another question.
The very best book is in the form of the help docs for MATLAB. This is because any text is limited. It covers the functions the author thought to put in it, what the author thinks is useful. And it also reflects MATLAB as of a few years ago, since a book takes time to write and publish. So texts will be out of date compared to the help docs.
So the very dirst thing when you have no idea what a function does is to use doc.
doc deal
and
doc matlabFunction
These docs will explain the use of those tools. And they will include examples.
Then, TRY THEM OUT. Get your hands dirty, so to speak. Play with the functions. If and when you become confused, then ask a (separate) question on Answers.
syms x
F = matlabFunction(x.^2)
LOOK AT F. TRY IT. I will not do that for you here, since you won't learn unless you are the one making an effort. If you have questions about what you see there, then try
doc function_handle
Look at the examples you see there. Try using it in MATLAB. Test your hypothesis as to what it does and how it works.
Anyway, if I did give you detailed answers in this comment to your initial question, that would just encourage you to ask more questions about different things as followups to this question.
Más respuestas (0)
Ver también
Categorías
Más información sobre Assumptions en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!