Plotting a function

2 ビュー (過去 30 日間)
Dennis
Dennis 2012 年 2 月 3 日
I have this assignment to plot a graph and print it out. The problem is I cannot get a plot of this function. I've searched for possible answers and have tried them but I get the error "??? Error using ==> mpower Matrix must be square." I know the usual solution is adding a . to the variable but that did not work. Here is the function I need plotted.
A = 1/((.8441^2-x^2)^2+(.8441*x/4)^2)^(1/2) where x goes from 0 to 2 in increments of lets say .01
If I could get some help on this, I would be greatly appreciative.

採用された回答

Kevin Holst
Kevin Holst 2012 年 2 月 3 日
f = @(x) 1/((.8441^2-x^2)^2+(.8441*x/4)^2)^(1/2);
fplot(f,[0,2])

その他の回答 (1 件)

Sean de Wolski
Sean de Wolski 2012 年 2 月 3 日
You need a . before a ^ so that it is an element by element power instead of a matrix power.
doc vectorize
will probably be your friend.

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by