Not able to plot a proper graph for the equation.

y = (1*1*((25)-(x.^2)))/((x.^4)-((x.^2)*((1*(1.78))+(25)+1))+(1*(25)));
fplot(y);
i used this code but am only getting a straight line instead of the 2 peak FRF that I want.

7 件のコメント

Torsten
Torsten 2024 年 6 月 8 日
Add the line
syms x
at the beginning of your code.
Kartikeya
Kartikeya 2024 年 6 月 8 日
I got the curve with 4 roots as needed, but now I need the values only in the positive side of both x and y basically the first quadrant. What should I do for the same?
Sam Chak
Sam Chak 2024 年 6 月 8 日
In that case, try solving the denominator to get 4 roots and extract only the positive values. One root is near 1 and the other is near 5. These are the breakpoints.
Use step size 0.1 for plotting the curve.
You can also use xline() function to add the dashed line asymptotes
Kartikeya
Kartikeya 2024 年 6 月 8 日
@Sam Chak is it possible that you can edit the code for the same?
syms x;
y = (1*1*((25)-(x.^2)))./((x.^4)-((x.^2)*((1*(1.78))+(25)+1))+(1*(25)));
fplot(y);
xlabel('Natural Frequency Ratio');
ylabel('Amplitude x_0');
Torsten
Torsten 2024 年 6 月 8 日
To restrict the plot to certain x- and y-ranges, use xlim and ylim:
Kartikeya
Kartikeya 2024 年 6 月 8 日
@Torsten@Sam Chak Is it possible to get a graph like the following one for my case?
Kartikeya
Kartikeya 2024 年 6 月 8 日
@Torsten@Sam Chak Thanks for the answers guys.

サインインしてコメントする。

 採用された回答

John D'Errico
John D'Errico 2024 年 6 月 8 日
編集済み: John D'Errico 2024 年 6 月 8 日

0 投票

syms x
y = (1*1*((25)-(x.^2)))/((x.^4)-((x.^2)*((1*(1.78))+(25)+1))+(1*(25)))
y = 
First, where are the poles? A pole lives where the denominator is zero.
[N,D] = numden(y)
N = 
D = 
droot = solve(D)
droot = 
double(droot)
ans = 4x1
0.9650 5.1816 -0.9650 -5.1816
<mw-icon class=""></mw-icon>
<mw-icon class=""></mw-icon>
So we need to look between -6 and 6.
fplot(y,[-6,6])
NO. It does not look the way you want it to look. But it is your function. You set the problem. If it does not look like what you want, then maybe you are starting with the wrong function.

3 件のコメント

Sam Chak
Sam Chak 2024 年 6 月 8 日
I guess OP probably wants to plot the magnitude of the function, something like the Bode plot.
John D'Errico
John D'Errico 2024 年 6 月 8 日
編集済み: John D'Errico 2024 年 6 月 8 日
That could be. And you could have offered that as an answer. But my mind reading abilities are sometimes lacking, only answering the question posed, instead of answering a different question. If I always tried that, I'd end up chasing into infinitely many rabbit holes.
Kartikeya
Kartikeya 2024 年 6 月 8 日
@Sam Chak @Torsten @John D'Errico Guys I got the whole thing. Just had to use the absolute values of the y variable that I got. Thanks for your help, all of you.
x = 0:0.1:10;
y = (1*1*((25)-(x.^2)))./((x.^4)-((x.^2)*((1*(1.78))+(25)+1))+(1*(25)));
plot(y);
xlim([0 100]);
ylim([0 inf]);
xlabel('Natural Frequency Ratio');
ylabel('Amplitude x_0');
z = abs(y);
disp(z);
plot(z);

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCreating, Deleting, and Querying Graphics Objects についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by