필터 지우기
필터 지우기

User-defined function help

조회 수: 2 (최근 30일)
Elizabeth Jurgensen
Elizabeth Jurgensen 2018년 3월 4일
댓글: Prajith Chilummula 2018년 3월 12일
function [Temp] = TempProfile(r)
%UNTITLED9 Summary of this function goes here
% Detailed explanation goes here
Temp = 1500-(((9.61*10e26)*r.^2)/(4*0.05));
end
I have the function above. I am trying to display the Temp for the value of r; r = 0:0.41 How would I display all the values of Temp for all the values of r? Where would I define r as 0:0.41? Thank you so much!
  댓글 수: 2
Walter Roberson
Walter Roberson 2018년 3월 4일
There are approximately 2^59 representable numbers in the range 0 to 0.41. You do not have have enough memory to store all of the calculations and calculating them all would take many centuries.
I recommend that you reconsider displaying all of those values. Perhaps you do not need more than (say) 1000000000000 of the values in that range.
Prajith Chilummula
Prajith Chilummula 2018년 3월 12일
Consider the number of values you want to use between 0 and 0.41 and modify the increment step likely.Then you can pass the vector as argument and get the output temp array.You can plot the arrays.
Example:
r=0:0.1:0.41;
temp=TempProfile(r);
plot(r,temp);

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

답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by