write down a function
2 ビュー (過去 30 日間)
表示 古いコメント
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
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
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 件のコメント
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.
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!