log bolting in y and x cordinates

조회 수: 1(최근 30일)
Mustafa Alhandhali
Mustafa Alhandhali 2019년 4월 6일
답변: David Wilson 2019년 4월 8일
i have this equation adn i want to plot it respect to w which change from 0 to 1200
xss= abs((287*w^2*(w^2*(5*i) + w - 88000*i))/(50*(w^4*(2500*i) + 1000*w^3 + w^2*(-54000099*i) - 9905000*w + 162800000000*i)) - (w^2*(w*i + 880000)*287*i)/(500*(2500*w^4 + w^3*(-1000*i) - 54000099*w^2 + w*(9905000*i) + 162800000000)))
i want the y axis to be f in log and w in x-axsis normal scale it shouls looks like thishw.PNG

답변(1개)

David Wilson
David Wilson 2019년 4월 8일
You have a pretty ugly equation there, and you haven't made it easy for yourself by writing the thing un-vectorised in one long line. You also could have written "88000*i" as simply "88000i" without the * symbol. This ensures that you don't overwrite i as say an index.
Below I've vectorised it, and plotted it, and get something similar, but not exactly what you've indicated is the solution.
w = linspace(0,1200)';
i = sqrt(-1);
xss= abs((287*w.^2.*(w.^2*(5i) + w - 88000i))./(50*(w.^4*(2500i) + ...
1000*w.^3 + w.^2*(-54000099i) - 9905000*w + 162800000000i)) - ...
(w.^2.*(w*i + 880000)*287i)./(500*(2500*w.^4 + w.^3*(-1000i) - 54000099*w.^2 + ...
w*(9905000i) + 162800000000)));
semilogy(w,xss)
xlabel('\omega (rad/s)')

Community Treasure Hunt

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

Start Hunting!

Translated by