I got a non-answer from solve()
조회 수: 7 (최근 30일)
이전 댓글 표시
Here's some code. I know that one solution is eta = pi/6, A=20, and k=2*pi/lambda. I get a non-answer (A=A, eta=eta, k=k) from solve():
reset(symengine);clear all;
syms x lambda A k positive;
syms eta;
lambda = 1;
eq1 = A*sin(eta)-10;
eq2 = A*sin(k*lambda/6 + eta)-20;
eq3 = A*sin(k*5*lambda/12 + eta);
% try to solve
solve(eq1,eq2,eq3,A,eta,k)
ans =
A: [1x1 sym]
eta: [1x1 sym]
k: [1x1 sym]
Other things I've tried have yielded different results, but they were also non-productive. What am I missing here?
Thanks,
Susan
댓글 수: 0
채택된 답변
Sean de Wolski
2011년 6월 2일
You get an answer!
b = solve(eq1,eq2,eq3,A,eta,k)
b.A %A
b.eta %eta
b.k %k
댓글 수: 6
Walter Roberson
2011년 6월 2일
Those values for A and k are incompatible with the "syms A k positive" that Susan had.
추가 답변 (1개)
Walter Roberson
2011년 6월 2일
Sometimes instead of putting an assumption on the range of a variable, it is better to select() the answers that meet the criteria.
댓글 수: 1
Walter Roberson
2011년 6월 2일
By selecting the admissible solutions after finding them all, the complete set I get is
[A = 20, eta = (1/6)*Pi, k = 2*Pi]
[A = 20, eta = (5/6)*Pi, k = 10*Pi]
[A = (80/7)*14^(1/2), eta = -arctan((1/11)*7^(1/2))+Pi, k = -12*arctan(7^(1/2))+12*Pi]
[A = (80/7)*14^(1/2), eta = arctan((1/11)*7^(1/2)), k = 12*arctan(7^(1/2))]}
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!