can i make a symbolic function without a specific formula?
Mostrar comentarios más antiguos
If I have data in two vectors which represents x and y for any experiment and I want to make a symbolic function that can represent y as a function of x but i have no specific formula for y just the measurements between x and y . How i can do that is there any code for that other than interpolation??
Respuestas (2)
Cris LaPierre
el 14 de Nov. de 2018
0 votos
I'm not sure interpolation would help you. My approach would be to visualize the data and then decide what type of equation to fit the data to.
Walter Roberson
el 14 de Nov. de 2018
syms XX
tt = num2cell( [XX == x(:),y(:)].' );
ff(XX) = piecewise(tt{:});
Now if I got everything right then ff should be a symbolic function such that if you input one of the values from x then it should return the corresponding value for y. For all other values it should return sym(nan)
This is not likely to be a useful function, but I guess you have your reasons for wanting it.
3 comentarios
ghghgh
el 15 de Nov. de 2018
ghghgh
el 15 de Nov. de 2018
Walter Roberson
el 15 de Nov. de 2018
No, you are mistaken . You do want NaN for ff(2.5) You were quite clear in your original question ,
How i can do that is there any code for that other than interpolation??
Interpolation is the word that covers all possible techniques for forecasting intermediate values based upon known values . When you said "other than interpolation" then you indicated that absolutely no forecasting was to be permitted, that the function should only ever return the values already known and never ever any other value . And that is what my code does for you .
Categorías
Más información sobre Numeric Solvers en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!