My plot command produces a blank graph, why?
6 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
See below for the code. I expect to see two graphs but what I get is two blank graphs. Can someone tell me what I'm doing wrong?
% Clear everything and close everything
clear all;
close all;
% Determine the elongation of the cylinder as given by the equation w/o n
% Apply a load P (Pa)
P=40000000;
% Determine the length of the cone (m)
L = 1;
% Determine the radius (m)
c = .025;
% Determine the Modulus of Elasticity AKA Young's Modulus (Pa)
E = 31100000000;
% Determine the elongation
deformation =(P*L)/(2*3.141*c^2*E);
% Determine the elongation of the cylinder as given by the equation w/ n
% Determine the number of circlular cylinders
n = 6;
% Determine the length of each circular cylinder
L_n = L/n;
% Determine the radius of a single ciruclar cylinder
r = sqrt(((4/3)*3.141*c^2*L_n)/(3.141*L));
% Determine the area
A = 3.141*(r^2);
% Determine the elongation
deformation_n =(P*(L_n))/(A*E);
% Determine the error between the two results
error = -((deformation-deformation_n)/(deformation))*100;
% State the results
fprintf('The elongation of the cone without %g circular cylinders is %g m\n', n,deformation);
fprintf('The elongation of the cone with %g circular cylinders is %g m\n', n,deformation_n);
fprintf('The percent error calculated between the two is %g %%\n', error)
% Calculate the average axial stress
sigma = P/A;
% Calculate the average axial strain
epsillon = sigma/E;
% Plot the average axial stress and strain vs. length
% Axial stress vs. length
figure(1)
plot(sigma,L)
xlabel('Average Axial Stress [Pa]')
ylabel('Length [m]')
title('Average Axial Stress vs. Length')
% Axial strain vs. length
figure(2)
plot(epsillon,L)
xlabel('Average Axial Strain [Pa]')
ylabel('Length [m]')
title('Average Axial Strain vs. Length')
1 Commento
Risposte (1)
Robert U
il 5 Ott 2022
Hi Spencer,
Your plot contains a single point. You can make it visible with 'o' extension:
% Clear everything and close everything
clear all;
close all;
% Determine the elongation of the cylinder as given by the equation w/o n
% Apply a load P (Pa)
P=40000000;
% Determine the length of the cone (m)
L = 1;
% Determine the radius (m)
c = .025;
% Determine the Modulus of Elasticity AKA Young's Modulus (Pa)
E = 31100000000;
% Determine the elongation
deformation =(P*L)/(2*3.141*c^2*E);
% Determine the elongation of the cylinder as given by the equation w/ n
% Determine the number of circlular cylinders
n = 6;
% Determine the length of each circular cylinder
L_n = L/n;
% Determine the radius of a single ciruclar cylinder
r = sqrt(((4/3)*3.141*c^2*L_n)/(3.141*L));
% Determine the area
A = 3.141*(r^2);
% Determine the elongation
deformation_n =(P*(L_n))/(A*E);
% Determine the error between the two results
error = -((deformation-deformation_n)/(deformation))*100;
% State the results
fprintf('The elongation of the cone without %g circular cylinders is %g m\n', n,deformation);
fprintf('The elongation of the cone with %g circular cylinders is %g m\n', n,deformation_n);
fprintf('The percent error calculated between the two is %g %%\n', error)
% Calculate the average axial stress
sigma = P/A;
% Calculate the average axial strain
epsillon = sigma/E;
% Plot the average axial stress and strain vs. length
% Axial stress vs. length
figure(1)
plot(sigma,L,'o')
xlabel('Average Axial Stress [Pa]')
ylabel('Length [m]')
title('Average Axial Stress vs. Length')
% Axial strain vs. length
figure(2)
plot(epsillon,L,'o')
xlabel('Average Axial Strain [Pa]')
ylabel('Length [m]')
title('Average Axial Strain vs. Length')
I assume you try to perform a 1D finite element calculation and visualize the results. Maybe you should have a look into the Matlab documentation under language fundamentals to get familiar with the concept of vector calculus.
Your code does not resolve the single node parameters but merely one node.
Kind regards,
Robert
0 Commenti
Vedere anche
Categorie
Scopri di più su Stress and Strain in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!