Hello members, I need some help.
rho_grid=[-1,0,1];Nrho=length(rho_grid);for i=Nrho:-1:1 rho1=rho_grid(i); for j=Nrho:-1:1 rho2=rho_grid(j); [U,S,V]= svd(pro(rho1,rho2)); [Uvals(:,:,j,i),Svals(:,:,j,i),Vvals(:,:,j,i)]= svd(pro(rho1,rho2)); % I need this later for plotting
Ti= inv(sqrt(S))*U'*Rq(rho1,rho2); T = Rp(rho1,rho2)*V*inv(sqrt(S)); systrans(:,:,j,i)= ss2ss(sys.Data(:,:,j,i),Ti); endend
1) I have 2 'for' loops now to determine value of parameters 'rho1' and 'rho2'. In my case, this parameters will increase to very large number. If I have rho1,….,rho10 , I dont want to create all extra for loops manually. Is there any way that I can automate it? Please note that rho_grid = [-1,0,1] is same for all parameters. Similarly,
2) The dimension of 'systrans' will also change. If I add 1 extra for loop to this I have to change from my current systrans(:,:,j,i) to
systrans(:,:,k,j,i)
which I want to avoid and automate.
3) Last question, I want plot values stored in 'Svals' over parameter range. When I had only one parameter 'rho1' I did this:
plot(rho_grid,reshape(Svals(i,i,:),[1,length(rho_grid)]));
which gave me 2D plot. for 2 parameters case, I want to get a 3D plot and see the variation of entries of Svals over rho1 and rho2. How can I do that? I have attached Uvals,Svals and Vvals in .mat file
Best Answer