Optimization and curve fitting are essential techniques in data analysis, enabling precise mathematical modeling and optimization of real-world problems. Master topics like fminsearch, fmincon, polynomial fitting, interpolation, and smoothing.
MCQs
1. Introduction to Optimization (fminsearch, fmincon)
Which MATLAB function is used to find the minimum of an unconstrained multivariable function? a) fminsearch b) fmincon c) linprog d) quadprog
What does the fmincon function in MATLAB handle that fminsearch does not? a) Polynomial fitting b) Nonlinear constraints c) Symbolic computations d) Matrix inversion
In optimization problems, what is the “objective function”? a) The function to minimize or maximize b) The gradient of the solution c) The constraint applied d) The feasible region
Which of the following options is a valid constraint type in fmincon? a) Inequality constraints b) Equality constraints c) Both a and b d) Neither a nor b
When using fminsearch, the objective function must: a) Return a scalar value b) Be linear c) Contain constraints d) Be a matrix
What algorithm does fminsearch primarily use? a) Newton’s Method b) Nelder-Mead Simplex c) Gradient Descent d) Simulated Annealing
Which parameter is adjusted to control the accuracy of the solution in fmincon? a) ConstraintTolerance b) ObjectiveFunctionTolerance c) MaxFunctionEvaluations d) StepTolerance
Which output from fmincon provides information about convergence? a) Objective function value b) Gradient c) Exit flag d) Optimization variable
2. Polynomial Fitting (polyfit, polyval)
What does the polyfit function return? a) Coefficients of the polynomial fit b) Fitted data points c) Derivative of the polynomial d) Interpolated values
The polyval function is used for: a) Calculating polynomial coefficients b) Evaluating a polynomial at specific points c) Smoothing noisy data d) Finding roots of a polynomial
To fit a quadratic polynomial using polyfit, the degree parameter should be set to: a) 1 b) 2 c) 3 d) 4
Which input argument does polyfit require apart from the data? a) Objective function b) Degree of the polynomial c) Constraints d) Interpolation points
A larger degree in polyfit can lead to: a) Underfitting b) Overfitting c) Improved accuracy d) Reduced execution time
What happens if there are fewer data points than the polynomial degree in polyfit? a) The fit fails b) Overfitting occurs c) Interpolation happens d) The degree is adjusted automatically
If p is a polynomial coefficient vector, what does polyval(p, x) do? a) Computes polynomial roots b) Evaluates the polynomial at x c) Finds the derivative d) Fits data points
3. Curve Fitting Toolbox
The Curve Fitting Toolbox primarily supports: a) Interpolation only b) Parametric and non-parametric fitting c) Symbolic calculations d) Linear optimization
Which GUI in MATLAB allows interactive curve fitting? a) Simulink b) cftool c) sfit d) appdesigner
Which of the following fitting options is NOT available in the Curve Fitting Toolbox? a) Polynomial fitting b) Fourier fitting c) Linear regression d) Genetic algorithm fitting
The “goodness of fit” is measured using: a) Residuals b) R-squared c) Both a and b d) None of the above
Which method is used to smooth noisy data in the Curve Fitting Toolbox? a) Lowess b) Spline c) Polynomial regression d) All of the above
Which statement is true about non-linear fitting in the Curve Fitting Toolbox? a) It requires initial parameter guesses b) It only fits polynomials c) It is faster than linear fitting d) It cannot handle noisy data
4. Data Interpolation and Smoothing
Which MATLAB function is used for 1-D interpolation? a) interp1 b) spline c) polyval d) curvefit
What type of interpolation is provided by the interp1 function when using the ‘linear’ method? a) Smoothing b) Straight-line interpolation c) Polynomial interpolation d) Nearest-neighbor interpolation
Which function is suitable for cubic spline interpolation? a) interp1 b) spline c) polyfit d) polyval
What is the primary advantage of spline interpolation? a) High computational speed b) Produces smooth curves c) Requires fewer data points d) Guarantees exact fit
Data smoothing techniques are used to: a) Interpolate missing values b) Reduce noise in data c) Increase data resolution d) Extrapolate trends
What does the smooth function in MATLAB primarily do? a) Fits polynomial models b) Removes high-frequency noise c) Computes derivatives d) Performs interpolation
When applying the moving average method, the window size controls: a) Number of coefficients b) Degree of polynomial c) Amount of smoothing d) Speed of computation
Which function applies a Savitzky-Golay filter for smoothing? a) sgolay b) smooth c) interp1 d) curvefit
What happens when the window size for smoothing is too large? a) Data becomes oversmoothed b) Noise increases c) Trend accuracy improves d) Computation time decreases