-4
A
回答
2
的fzero函數期望得到的功能手柄和一個起點。它的結果是作爲函數根的最近點。在你的情況下,我們正在尋找在x = 1附近的cos(2x)-sin(x)= 0的根。你需要的代碼是:
fun = @(x)(cos(2*x)-sin(x)); % Create an anonymous function handle.
x0 = 1; % Set a starting point.
res = fzero(fun, x0); % Calculate the nearest root.
0
你的問題相當於找到一個函數的零點:
f=cos(2.*x)-sin(x)
首先,f
創建新的函數文件:
function y = funczero01(x)
%Finding the zeros of the function below
y=cos(2.*x)-sin(x);
endfunction
保存文件與funczero01.m
並加載它的路徑。 然後在調試器窗口調用funczero01
:
x0=fzero('funczero01',1)
x0 = 0.52360
確保你真正瞭解fzero('func',x0)
。欲瞭解更多詳情,請查看Matlab文檔。
相關問題
- 1. MATLAB中函數'fzero'
- 2. MATLAB - fzero初始猜測
- 3. MATLAB錯誤使用fzero
- 4. MATLAB:在具有向量輸出的函數上使用FZERO
- 5. 將MATLAB的fzero函數(布倫特方法)轉換爲C代碼
- 6. MATLAB函數
- 7. MATLAB函數
- 8. MATLAB函數
- 9. Matlab discontiniuos函數
- 10. Matlab函數huge_add?
- 11. MATLAB函數conv2
- 12. Matlab repr函數
- 13. MATLAB函數語法
- 14. matlab函數減速
- 15. MATLAB MIRtoolbox - mirtempo函數
- 16. Python vs Matlab函數
- 17. c#mat2gray(matlab)函數
- 18. Matlab相關函數
- 19. MATLAB的fminsearch函數
- 20. 魔方函數Matlab
- 21. Matlab或C函數
- 22. matlab函數是一個整數函數
- 23. 矩陣功能,fzero不工作
- 24. 從MATLAB函數傳遞矩陣到MATLAB函數
- 25. 對於'sym'類型的輸入參數,使用fzero:未定義的函數或方法'isfinite'
- 26. MATLAB函數輸入參數
- 27. MATLAB函數矩陣參數
- 28. MATLAB函數和參數
- 29. Matlab:在matlab中的滾動函數
- 30. MATLAB回調函數:未定義函數?