Create a function to calculate hyperbolic's then graph them?

I need some advice about graphing the hyperbolic sin, cos and tan. Can you create a plot inside a function? well heres what i have... Thanks in advance!
function [sinh1x,cosh1x,tanh1x] = hyper(X)
sinh1x=sinh(X);
cosh1x=cosh(X);
tanh1x=tanh(X);
plot(X,sinh1x)
plot(X,cosh1x)
plot(X,tanh1x)
grid on
end

 採用された回答

Matt Fig
Matt Fig 2011 年 4 月 10 日

0 投票

About the only thing you might want to change is to put a call in to the HOLD function so that all plots appear on the same axis, or pass all the arguments to plot at once. Like this:
function [sinh1x,cosh1x,tanh1x] = hyper(X)
sinh1x = sinh(X);
cosh1x = cosh(X);
tanh1x = tanh(X);
plot(X,sinh1x,X,cosh1x,X,tanh1x)
legend({'sinh(x)';'cosh(x)';'tanh(x)'},'location','northwest')
grid on
Then call it like this:
>> [sinh1x,cosh1x,tanh1x] = hyper(0:.01:1);

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeNetworks についてさらに検索

質問済み:

2011 年 4 月 10 日

Community Treasure Hunt

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

Start Hunting!

Translated by