Convert 3D matrix in 2D data matrix

2 vues (au cours des 30 derniers jours)
Willemijn Wolf
Willemijn Wolf le 15 Mar 2017
Hi. I have to create for every x a graph that plots the results of Hquest2 v.s. h for 4 different t's. With Hrow I try to store data to plot for at least one of my x values. This is now an 4X1X20 but I would actually like to store this data in a 2D matrix (4x20). How can I efficiently do this in this loop?
xquest2 = [(labdaw/4), (labdaw/2.0), labdaw] ;
Hrow = zeros(i,j,h)
z = linspace(20,25,20) ;
for i = 1:3;
for j = 1:4;
for h = 1:20;
Hquest2(j,i,h) = H0*exp(-x(i)/labdaw - delta*z(h)/d1) *cos(omega*t(j) - a*x(i)/labdaw - delta*z(h)/d1);
end
end
Hrow = Hquest2(:,i,:);
end

Réponse acceptée

Jan
Jan le 15 Mar 2017
I'm not sure what your question is. A guess:
Hrow = squeeze(Hquest2(:,i,:));
Hrow = zeros(i,j,h) looks confusing already. What is i,j,h here?

Plus de réponses (1)

Alexandra Harkai
Alexandra Harkai le 15 Mar 2017
Hrow = squeeze(Hquest2(:,i,:));

Catégories

En savoir plus sur Graphics Object Programming dans Help Center et File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by