Plotting Issue for a quartic equation

4 views (last 30 days)
Yu Xiong
Yu Xiong on 13 Feb 2015
Answered: John D'Errico on 13 Feb 2015
Hi
I just got an issue for plotting a quartic equation like y = (x.^2+1).^2/x.^2 which always give me back a linear spot-points figure. However, I tried to use MuPAD to plot this function which returned the result is what I expected. So, I am thinking it might be the expression format which was defined differently in MATLAB.
Could someone point out the issue?
Thanks Yu
Code in MATLAB (Actually, it will be four functions in total)
y = (x.^2+1).^2/x.^2;
figure
plot(x,y)
Code in MuPAD
plot(y=(R^2 + 1)^2/R^2, y=(R^2 + 4)^2/(4*R^2), y=(R^2 + 9)^2/(9*R^2), y=(R^2 + 16)^2/(16*R^2), R=0..5, y=0..10)

Answers (1)

John D'Errico
John D'Errico on 13 Feb 2015
You seem to understand about the use of and need for the dot operators, such as .^, so why do you not use ./ for division? That little . before the / is important. Use it.

Community Treasure Hunt

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

Start Hunting!