필터 지우기
필터 지우기

how to load .txt data into a function and use it as variables in matlab function

조회 수: 1 (최근 30일)
Hi All,
I would like to use my out source data (in .txt), into finding a graph. The data is b = a070_edit(:,1) are an variables that are varies along the frquecy range. The 'b' data will be used as an varible in a function to find an unknown 'a'. and then a graph will be plotted (f vs a).
Actually my equation is much more complicated. Thus below I use a simple equation, so that it will be easier to solve the problem.
function
load a070_edit.txt % list of data from outsource
b = a070_edit(:,1)
d = 1;
t = 5./b;
f = 50:1.5625:5600;
w = 2.*pi.*f;
a = (d./t).*w
plot (f,a)
end
Kindly, please help me to load and use an external data into matlab function.
Your help will be appreciated.
Thank you.
Regards,
Nur Arafah

채택된 답변

madhan ravi
madhan ravi 2019년 5월 16일
편집: madhan ravi 2019년 5월 16일
B % just call it
function B % not if the file is input from outside the function then parameterize you function by providing an input for it
load a070_edit.txt % list of data from outsource
b = a070_edit(:,1);
d = 1;
t = 5./b;
f = 50:1.5625:5600;
w = 2.*pi.*f;
a = (d./t).*w;
plot(f,a)
end
  댓글 수: 3

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

추가 답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by