Run your program for the sequence of steps N = 2, 4, 8, 16. Write the Matlab rou
ID: 2247432 • Letter: R
Question
Run your program for the sequence of steps N = 2, 4, 8, 16. Write the Matlab routine which computes the root-mean-square (RMS) error for each case as: r_N = e_N/Squareroot (u^ex_1)^2 + (u^ex_2) + middot middot middot + (u^ex_N)^2 + (u^ex_N)^2/N And the relative error as r_N = e_N/Squareroot (u^ex_1)^2 + (u^ex_2) + middot middot middot + (u^ex_N)^2 + (u^ex_N)^2/N Analyze the behavior of the relative error as function of h/L = 1/N. The best way to do it is to make a ln-ln plot. The error typically behaves according to the power law: r_N = C (h/L)^m rightarrow lnr_N = lnC - m ln (L/h) = ln C - m ln N Both the pre-exponential C and the power m are easily found from ln-ln plot which should be close to a straight line (except for very large h). Discuss your findings. Run for sequence of 5 spring constant K (all other parameters remain the same. If the spring constant from part (1) is k_0 then the sequence of spring constant is k_0/100, k_0/10, 10k_0, 100k_0. Discuss your result, and conclude relationship between K and results.Explanation / Answer
Syntax:
Y = RMS(X)
Y = RMS(X,DIM)
Explanation:
Y = RMS(X) returns the root-mean-square (RMS) level of the input, X. If X is a row or column vector, Y is a real-valued scalar. For matrices, Y contains the RMS levels computed along the first nonsingleton dimension. For example, if X is an N-by-M matrix with N > 1, Y is a 1-by-M row vector containing the RMS levels of the columns of X.
Y = RMS(X,DIM) computes the RMS level of X along the dimension, DIM.
Or simply use this also:
RMSE = sqrt(mean((y-y_pred).^2));
Or easy to approach:
r = sqrt( sum( (data(:)-estimate(:)).^2) / numel(data) );
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.