Azzera filtri
Azzera filtri

3d plotting error - incorrect dimensions

3 visualizzazioni (ultimi 30 giorni)
Hi,
I have a problem with 3d plotting and I don't know why. MATLAB gives me an error. If anyone can help me with it, I will really appreciate it. The code is attached below.
Best,
clear
close all
Wq=0.55272; % torsional frequency in Hz
Wx=0.50914; % Lateral frequency in x direction (Hz)
Wy=0.51109; % Lateral frequency in w direction (Hz)
Qx=Wq/Wx; % frequency ratio
Qy=Wq/Wy; % frequency ratio
% ex=0.204; % geometric eccentricity in x direction
% ey=0.204; % geometric eccentricity in y direction
% e=sqrt(ex^2+ey^2); % absolute eccentricty
Lx=35; % building dimension in x direction in meter
Ly=35; % building dimension in x direction in meter
rx=Lx/sqrt(12); % radius of gyration in x direction
ry=Ly/sqrt(12); % radius of gyration in y direction
r=sqrt(rx^2+ry^2); % absolute radius of gyration
% ref=r+e; % effective radius of gyration
nt=1.134 % nt=(delta max/delta avg)
nt = 1.1340
Ax=(nt/1.2)^2; % torsional irregularity coefffcient Ax=(delta max/1.2delta avg)^2
Lamda=(1.2*sqrt(Ax)-1)/(0.6*sqrt(Ax)); % proposed torsional coeffcient
% k=1
% for nt=1:0.01:10 % nt=(delta max/delta avg)
% Ax(k)=(nt/1.2)^2; % torsional irregularity coefffcient Ax=(delta max/1.2delta avg)^2
% Lamda(k)=(1.2*sqrt(Ax)-1)/(0.6*sqrt(Ax)); % proposed torsional coeffcient
% k=k+1;
% end
% nt=1:0.01:10;
% figure (1)
% plot (nt,Lamda)
%edx=((Qy*ref)^2/(Lx))*Lamda % design eccentricty in x direction
% edy=((Qx*ref)^2/(Ly))*Lamda % design eccentricty in y direction
e=[0:1:10];
Ax=[1:1:10];
[ee,Axx]=meshgrid(e,Ax);
edx=((Qy*(((sqrt((Lx^2)/12+(Ly^2)/12))+ee))).^2/(Lx))*((1.2*(Axx.^0.5)-1)/(0.6*(Axx.^0.5))) % design eccentricty in x direction
Warning: Rank deficient, rank = 1, tol = 1.537023e-14.
Error using *
Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the number of rows in the second matrix. To operate on each element of the matrix individually, use TIMES (.*) for elementwise multiplication.
figure
surf(ee,Axx,edx);

Risposta accettata

Image Analyst
Image Analyst il 8 Mag 2023
Try using ./ instead of / and .* instead of *
  3 Commenti
Image Analyst
Image Analyst il 8 Mag 2023
Your equation is way too complicated. Try breaking it up into bite sized chunks and look at each term. For example
term1 = (Lx^2)/12
term2 = (Ly^2)/12
term3 = sqrt(term1 + term2) + ee
% edx=((Qy*(((sqrt((Lx^2)/12+(Ly^2)/12))+ee))).^2/(Lx))*((1.2*(Axx.^0.5)-1)/(0.6*(Axx.^0.5)))
edx = ((Qy * term3 .^ 2 ./ Lx) .* ((1.2*(Axx.^0.5)-1)/(0.6*(Axx.^0.5))) % design eccentricty in x direction
and so on.
Osman AKYUREK
Osman AKYUREK il 10 Mag 2023
%% I have tried to solve it as you suggested but did not work again. Then I have come up with a new way which is double for loop and it works. Thank you for your time.
j=1
k=1
for e=0:0.1:10;
for Ax=0.7:0.1:10;
edx(k,j)=((Qy*(((sqrt((Lx^2)/12+(Ly^2)/12))+e)))^2/(Lx))*((1.2*(Ax^0.5)-1)/(0.6*(Ax^0.5)));
ee(k,j)= e;
Axx(k,j)=Ax;
k=k+1;
end
k=1;
j=j+1;
end
surf(ee,Axx,edx);
xlabel('Eccentricity (m)');
ylabel('Torsional coeffcient (Ax)');
zlabel('Design eccentricity (m)');
% shading interp
colorba

Accedi per commentare.

Più risposte (0)

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by