To create a script in MATLAB that takes input of 4 points on an XY graph and returns a series of points that create a curve, you can use the built-in curve fitting and data interpolation functions.
Here's an example script that demonstrates this:
main.m750 chars22 lines
You can modify the x and y arrays to input your desired points. The poly3 option in the fit function is for fitting a cubic polynomial curve. You can also try other curve fitting options like poly2 for a quadratic curve or poly4 for a quartic curve.
The script will generate a series of points (xFit and yFit) based on the fitted curve and plot them along with the original points.
Note: Keep in mind that fitting a curve through only 4 points may not always produce the desired results. More data points often lead to better curve fitting accuracy.
Also, make sure you have the Curve Fitting Toolbox installed in MATLAB, as it is needed for the fit function.
gistlibby LogSnag