Output a solution for a function at a specific value input

조회 수: 15 (최근 30일)
Shane Palmer
Shane Palmer 2020년 6월 3일
댓글: Shane Palmer 2020년 6월 3일
Hello,
I am trying to remember how to code a function (i.e. y = mx+b), to output a solution (y) by inputting a single input (x) without having to manually insert the (x) into my equation?
My function is "magT"
I would like to calculate the value magT(100), where 100 is the omega input.
I am not getting it to work properly though.
magT = sqrt((5.903*10^24)^2+(1.181*10^20*omega)^2)/sqrt((1.181*10^25-(2.361*10^16*omega^2))^2+(9.445*10^20*omega)^2);

채택된 답변

Stephan
Stephan 2020년 6월 3일
magT = @(omega)sqrt((5.903*10^24)^2+(1.181*10^20*omega)^2)/sqrt((1.181*10^25-(2.361*10^16*omega^2))^2+(9.445*10^20*omega)^2);
Y5 = magT(5)
Y10 = magT(10)
  댓글 수: 3
Stephan
Stephan 2020년 6월 3일
편집: Stephan 2020년 6월 3일
Get rid of
syms omega
and note that I defined a function handle:
magT = @(omega)sqrt((5.903*10^24)^2+(1.181*10^20*omega)^2)/sqrt((1.181*10^25-(2.361*10^16*omega^2))^2+(9.445*10^20*omega)^2);
Shane Palmer
Shane Palmer 2020년 6월 3일
That worked thank you, I've a long ways to go.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Function Creation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by