Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
3D Plotting in GUI

Subject: 3D Plotting in GUI

From: Adriano Tawin

Date: 30 Jul, 2014 21:39:10

Message: 1 of 1

Hi. I've been trying to create a 3D plot of 3 graphs. But instead of plotting just 1 point for each graph, I always end up having multiple points for each of the 3 graphs. Could someone kindly explain to me why is this so and how can I fix this problem? Attached below is the portion of coding that I am having problem with. Thank you.

% Calculate Mass Equivalent
M = num2str(((1/3).*(handles.SCdropdown + handles.CCdropdown).*(handles.Blasthinput).^3));
set(handles.Moutput,'String',M);

% Calculate Stiffness Equivalent
I = ((handles.Width./100).*((handles.Depth./100).^3).*(((5.5*0.01)+0.083)/2));
E = 200*10^9;

outEI =(E.*I);
K =((3.*outEI)./((handles.Length).^3));

Keq = num2str((K.*handles.Length)./4);
set(handles.Koutput,'String',Keq);

%Calculate Load Equivalent
P = num2str((handles.Pinput.*0.22)./handles.Length);
set(handles.Poutput,'String',P);

% ---- Classical Method (Chopra) -----
% Calculate Tn
Wn =(sqrt(K./M));
TN = (2*pi)./Wn;

td=0.00105;

%Calculate deformation
Rd= 2.*sin(pi.*td./TN);
Ust= (handles.Pinput)./K;
U1=(Ust.*Rd);
Impulse1=0.5.*(handles.Pinput).*td;

%----- Dunhamel Integral (Chopra) ------
U2=(((handles.Pinput)./K).*(1-cos(Wn.*td)));
Impulse2 = 0.5.*(handles.Pinput).*td ;

%------ Krauthamer Method --------
U3=(((handles.Pinput)./K).*sqrt((2+(Wn.*td).^2)-(2.*Wn.*td.*sin(Wn.*td))-(2.*cos(Wn.*td)))./(Wn.*td));
Impulse3 = 0.5.*(handles.Pinput).*td;

%-------PLOT 3D Diagram---------------------------------------

axes(handles.axes1);
plot3(U1, Impulse1, handles.SCdropdown + handles.CCdropdown,'ro',...
        U2, Impulse2, handles.SCdropdown + handles.CCdropdown,'bo',...
        U3, Impulse3, handles.SCdropdown + handles.CCdropdown,'ko','markersize',5);
xlabel ('Displacement [cm]');
ylabel('Impulse [MPa-s]');
zlabel ('Mass [Kg/m]');
legend('Classical Method','Dunhamel Integral','Krauthamer Method','Imported FE Data','Location','Northeast');
grid on;
rotate3d on;
 

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us