write down a function

조회 수: 4 (최근 30일)
Tala
Tala 2023년 5월 26일
댓글: Stephen23 2023년 5월 26일
I have saved the output of the convolution funtion in variable y (i.e. y=conv(x,h);). I want to print the function y as a fuction not as an array of the values in the graph. what is the matlab funtion that im supposed to use?
  댓글 수: 1
Stephen23
Stephen23 2023년 5월 26일
"what is the matlab funtion that im supposed to use?"
There are infinite functions which perfectly fit through any finite set of data points (like yours).
Which of those infinite functions do you want?

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

답변 (1개)

John D'Errico
John D'Errico 2023년 5월 26일
편집: John D'Errico 2023년 5월 26일
There is no "function". It sounds as if, given vectors x and h, you want to know what the function would have been, as if MATLAB could infer the true symbolic function. It can't. In fact, there is no unique function that answers your question. Sorry. Not everything you ask for has an answer in MATLAB, or in life.
Even if you were to look at the code, MATLAB does not compute a function, and then evaluate it, to then generate that vector. Instead, it computes the discrete convolution, as a vector from the two given vectors.
Even for a simpler problem, that is:
x = [2 3 4 5 6];
Can MATLAB know the true underlying "function" that would have generated that vector? In fact, again the answer is no, since there are infinitely many possible functions that could have generated that vector. Some are certainly simpler than others, but there is no right answer. In the above case, for t=1:5, the function I used was this:
t^5 - 15*t^4 + 85*t^3 - 225*t^2 + 275*t - 119
  댓글 수: 2
Tala
Tala 2023년 5월 26일
편집: Tala 2023년 5월 26일
thank you for your response, I was going with what a given assignment needed. I did not ask for your advice in life and please don't think I'd ever do.
Image Analyst
Image Analyst 2023년 5월 26일
Like John says, conv() gives a discrete, numerical solution/result. If you have functions/equations, you'd have to do that analytically from the formulas, like convolving two rect functions gives a triangle function.
If you ever need advice in bridge (the card game), John is the one to ask. He also has a ton of useful functions in his File Exchange: John D'Errico so check it out.

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by