フィルターのクリア

I am trying to find the positive roots of the equaiton y = ((exp(1).^​(-0.2*x)))​*(cos(2*x)​)-(0.15*x.​^2)+1, but I keep getting the error message saying that there arent enough input arguments. I dont know what to do.

2 ビュー (過去 30 日間)
Rebecca
Rebecca 2014 年 4 月 11 日
コメント済み: John D'Errico 2014 年 4 月 12 日
This is what I enter in my Editor window verbatim:
function y = f(x)
y = ((exp(1).^(-0.2*x)))*(cos(2*x))-(0.15*x.^2)+1;
fun=@f; % function
x0= [3,4]; % initial interval
x= fzero(fun,x0);
This is what I receive in the Command window after I run the function:
>> f Error using f (line 2) Not enough input arguments.
  1 件のコメント
John D'Errico
John D'Errico 2014 年 4 月 12 日
I do wonder why anyone would use a form like
exp(1).^(-0.2*x)
instead of the mathematically identical
exp(-0.2*x)

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

回答 (2 件)

Alberto
Alberto 2014 年 4 月 11 日
編集済み: Alberto 2014 年 4 月 11 日

Walter Roberson
Walter Roberson 2014 年 4 月 11 日
The lines starting from "fun=" should be in a different file, or entered in the command line, and you would run that rather than running f directly.

カテゴリ

Help Center および File ExchangeOptimization についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by