plotting root of Polynomial Equation
조회 수: 2 (최근 30일)
이전 댓글 표시
hi , I'm trying to plot a root of polynomial equation that have to set of complex solution as 1 X 4 cell
any suggestion how to plot the data obtianed
p = [0.20,0.23,0.25,0.27]';
er1 = (1+1.8*10^14*i);
er2 = (2.5+2.5*10^-3*i);
pol = [2+p*0, (-2+3*p)*er2 + (1-3*p)*er1, -er1*er2+p*0];
EQ2 = arrayfun(@(i) roots(pol(i,:)),1:numel(p),'uni',0);
plot(p,EQ2)
댓글 수: 1
John D'Errico
2019년 6월 20일
Note that the roots will not necessarily be in any special order. So when you do plot them in sequence with p, things may jump around.
One idea would be to convert the sequence of polynomials to a sequence of 4x4 matrices. This is called the companion matrix. you can find that in the function compan.
help compan
Then use my eigenshuffle utility (found on the file exchange) to resort the eigenvalues to be in a consistent order.
Finally, do as Star suggests, and plot the real part on the x axis, and the imaginary part on the y axis.
채택된 답변
Star Strider
2019년 6월 20일
You need to extract the double arrays from the cells in ‘EQ’:
plot(p,real([EQ2{:}]),'-', p,imag([EQ2{:}]),'--')
The cell2mat function is also an option.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Polynomials에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!