write down a function

4 visualizaciones (últimos 30 días)
Tala
Tala el 26 de Mayo de 2023
Comentada: Stephen23 el 26 de Mayo de 2023
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 comentario
Stephen23
Stephen23 el 26 de Mayo de 2023
"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?

Iniciar sesión para comentar.

Respuestas (1)

John D'Errico
John D'Errico el 26 de Mayo de 2023
Editada: John D'Errico el 26 de Mayo de 2023
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 comentarios
Tala
Tala el 26 de Mayo de 2023
Editada: Tala el 26 de Mayo de 2023
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 el 26 de Mayo de 2023
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.

Iniciar sesión para comentar.

Categorías

Más información sobre Mathematics en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by