make function from matrix

조회 수: 2 (최근 30일)
nader
nader 2025년 3월 24일
댓글: Stephen23 2025년 3월 31일
hi, i have some earthquake records matrix (time, acceleration), it contains about 3000 rows and 2 column, I need a f(x) function like a(time) which return acceleration of that time.
  댓글 수: 2
John D'Errico
John D'Errico 2025년 3월 24일
편집: John D'Errico 2025년 3월 24일
This vague question (lacking any data) is effectively impossible to answer, without trying to teach you the content of an entire course (or several courses) on interpolation, curve fitting, modeling, approximation, regression technizues, time series analysis, perhaps Fourier methods. I'm sure I left something out here. It will depend on the character of your data, the noise structure, and what you will do with the result. And all of that before you begin to think about code, writing anything in MATLAB.
You might start by looking at the tools in the curve fitting toolbox though. Your task will be in deciding first what kind of modeling you will do. How do you need to treat what must surely be noisy data, given the source.

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

답변 (1개)

Torsten
Torsten 2025년 3월 24일
t = linspace(0,10,3000).';
a = rand(3000,1);
f = @(x)interp1(t,a,x);
f(8.336)
ans = 0.1152
  댓글 수: 1
nader
nader 2025년 3월 28일

thank you, it's so helpful

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by