Hypobolic Tangent Function Question

I am a beginner with Matlab. I am trying to create a .m file that will plot a function for me. There are other parts to what I want to plot, but my problem is apparently something with plotting a hyperbolic tangent function that is in the denominator of a fraction. Here is a simplified version of my script:
y=-3:0.01:3; f=1/tanh(y) plot(y,f)
I keep getting an error on the second line. When I define other functions for "f" I get a plot, but I can't get the hyperbolic tangent function in the denominator to plot. Could someone please tell me what is wrong with my script?
Thanks, Allen

回答(1 个)

its easy to fix the error, vector computation is column wise :
y=-3:0.01:3; f=1./tanh(y); plot(y,f)

2 个评论

That fixed my problem! Thank you!
if the problem is completely solved, you accept the answer .

请先登录,再进行评论。

类别

帮助中心File Exchange 中查找有关 Mathematics 的更多信息

产品

标签

提问:

2013-10-13

Community Treasure Hunt

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

Start Hunting!

Translated by