How to create a function handle for thermodyna​mics(semi-​infinite heat conduction) using erfc with multiple variables?

조회 수: 1 (최근 30일)
%So my initial guess would be to create arrays or vectors for t, x, and alpha and try to pass those values through function handle something like :
thetafh = @(x,t,alpha) erfc(x/sqrt(4*alpha*t))
This is part of my final and any help is greatly appreciated please and thank you.
  댓글 수: 3
Henry B.
Henry B. 2021년 5월 27일
good to know I thought they were the same coding language as my class is taught as octave/matlab.
Henry B.
Henry B. 2021년 5월 27일
function [Theta] = InfConduct(x,t,alpha)
tfh = @(x,t,alpha) erfc(x./sqrt(4 .*alpha.*t))
Theta=0;
for k = 1:size(t)
Theta(k+1) = Theta(k) + tfh(k+1)
end
end
This is the code I have tried and when I try to use the example code in the command line it generates a function handle error.

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

채택된 답변

Torsten
Torsten 2021년 5월 27일
편집: Torsten 2021년 5월 27일
Use ./ instead of / in your definition of thetafh.
But you are asked to write a function, not a function handle.
  댓글 수: 7
Henry B.
Henry B. 2021년 5월 28일
thank you so much its matching with inputs listed and match the erfc function values
Torsten
Torsten 2021년 5월 28일
편집: Torsten 2021년 5월 28일
I wonder why you sum up the theta values.
A call to your function handle with t(i) already gives you the dimensionless temperature.
The fact that you get dimensionless temperatures that exceed the value of 1 show that your summation must be wrong.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Thermal Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by