Hi John,
As per the code you have provided, I observed that you are using a high-degree polynomial which is having a value of ‘35’ when calling the “polyfit” function for fitting your data, which can cause issues similar to one you are facing where plot is not visible.
This problem often arises because a polynomial fit of degree ‘35’ is extremely sensitive to the specific data points, leading to overfitting. Overfitting makes the model too closely aligned with the data points, which can result in a plot that does not visually represent the data well.
When testing with a similar setup, MATLAB throws a warning that the polynomial is badly conditioned, suggesting that the fit may not be appropriate.
Kindly refer to the image below to see the warning:
The above warning points towards possible solutions: adding more data points, reducing the polynomial's degree, or adjusting the data through centering and scaling.
For a more detailed explanation and potential solutions, please refer to the following MathWorks documentation on the "polyfit” function: www.mathworks.com/help/matlab/ref/polyfit.html
I hope the information provided above is helpful in resolving the issue.