solving sin(x) by solve commad?

조회 수: 13 (최근 30일)
metin yilmaz
metin yilmaz 2020년 11월 8일
댓글: John D'Errico 2020년 11월 9일
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.

채택된 답변

John D'Errico
John D'Errico 2020년 11월 8일
편집: John D'Errico 2020년 11월 8일
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 = struct with fields:
x: [1×1 sym] parameters: [1×1 sym] conditions: [1×1 sym]
xsol.x
ans = 
πk
xsol.conditions
ans = 
k
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
metin yilmaz
metin yilmaz 2020년 11월 9일
편집: metin yilmaz 2020년 11월 9일
But really, you need to start learning MATLAB. I can't be your tutor.
I have three different introductory matlab books but I can't some functions such as "deal" and "horzcat" in them. Would you please suggest me some books? The two with 300-400 pages do not cover even matlabfunction. Only the one with about 700pages cover it.
John D'Errico
John D'Errico 2020년 11월 9일
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.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Assumptions에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by