How to do a rank-1 approximation?
    97 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
    Jessica
 el 20 de Feb. de 2024
  
    
    
    
    
    Comentada: Jessica
 el 21 de Feb. de 2024
            I am able to perform most all this question is asking. I am NEW to coding (let me preface with that), and as such, we have not done anything with parts of what this question is asking (gasp). Here is what I did thus far in MatLab and the Question. I also do not understand why the answers are displayed as fractions when I did not type "format rat" in ... off in the workspace, the answers are displayed rounded to 4 decimal points. But, I am unsure how to get them displayed as such in my main display. THANK YOU!
- Use the svd() function in MATLAB to compute  , the rank-1 approximation of A. Clearly state what , the rank-1 approximation of A. Clearly state what is, rounded to 4 decimal places. Also, compute the root-mean square error (RMSE) between A and is, rounded to 4 decimal places. Also, compute the root-mean square error (RMSE) between A and . .


0 comentarios
Respuesta aceptada
  Karl
      
 el 21 de Feb. de 2024
        You can check the display format that's set, and change if necessary:
% Show the current display format.
display(format)
% Set short fixed point format, with 4 digits after the decimal point.
format short
When you know the functions that you need to use, but want to check their details, the help available at the MATLAB prompt can be really useful:
help help
From the help for svd, the formula that you've used for A1 isn't quite right.
From the help for rmse, you need to specify the two arrays that you want to compare.
3 comentarios
  Torsten
      
      
 el 21 de Feb. de 2024
				
      Editada: Torsten
      
      
 el 21 de Feb. de 2024
  
			A = [1 2 3; 3 3 4; 5 6 7]
[U, S, V] = svd(A)
A1 = S(1,1)*U(:,1)*V(:,1).'
A2 = A1 + S(2,2)*U(:,2)*V(:,2).'
A3 = A2 + S(3,3)*U(:,3)*V(:,3).'
norm(A-A1,'fro')/3
rmse(A,A1,'All')
norm(A-A2,'fro')/3
rmse(A,A2,'All')
norm(A-A3,'fro')/3
rmse(A,A3,'All')
Más respuestas (0)
Ver también
Categorías
				Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


