Question about typing in a function

조회 수: 1 (최근 30일)
Peter Phung
Peter Phung 2018년 4월 6일
댓글: Peter Phung 2018년 4월 6일
I have a function that my professor wants me to type into matlab and find where it converges to zero. I am having problems with the function itself where the professor got an "error" value of 94.6008 when f = 0.0001. However, I get an error value of 87.5678 when I set f = 0.0001. I must be typing in the function incorrectly, however I do not know the correct way of typing in the function.
Here is my code:
clear all; close all; clc
error = @(f) 1/sqrt(f) + 2.0*log((0.000042/3.7)+(2.51/(126400*sqrt(f))))
answer = error(0.0001)
Here is the original assignment

채택된 답변

Geoff Hayes
Geoff Hayes 2018년 4월 6일
Peter - try using log10 instead of log. This seems to give the desired result.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Entering Commands에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by