필터 지우기
필터 지우기

Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Solving Equations

조회 수: 1 (최근 30일)
Harriette
Harriette 2012년 3월 10일
마감: MATLAB Answer Bot 2021년 8월 20일
How do I simply solve and equation in Matlab?
I have defined a matrix m and k, and need to solve for L when det(k-L*m)=0.
I'd really appreciate as much help as you can give,
Thanks,
Harriette

답변 (1개)

Edwin Fonkwe
Edwin Fonkwe 2012년 3월 10일
Hi,
Is this a homework? Did you try something?
Anyways, I can think of three ways by which you can solve the problem: (1) Use fsolve. In your case for example after having defined m, k, use: L = fsolve(@(L) det(k-L*m) initial_value); Where initial_value is a guess (which you have to make) which should be close to your expected result. Might be a bit tricky to get, but for now try 0 (zero). I don't guarantee that it will always work anyway.
(2) Use fzero. In your case for example, you first define your function: fx = @(L)det(k-L*m); answer = fzero(fx,initial_value);
Again, you have a problem here, you need to have an idea about where your solution might be found. If you don't know try different values till you think your answer is right.
(3) Personally, I prefer this third method: write your own code. Vary L in steps of, say 0.00001 and for each step, compute det(k-L*m). Evaluate the error (with respect to zero) of the result. Repeat until your result is as close as you want to zero, say it is 1e-5 for example, then stop. The value of L at that point (or previous iteration) is your answer.
Hope this helps.

이 질문은 마감되었습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by