Clear Filters
Clear Filters

How to plot elongation of bar elements vs number of elements or size of elements?

2 views (last 30 days)
Hello sir and maam, mayb I ask help regarding plotting of the elongation vs the size or number of elements to see the line of error. Or I uploaded the sample photo I grabbed from one reference, May I ask a basic tutorial on how to do this? Thank you.

Answers (1)

Abhijeet
Abhijeet on 8 Mar 2023
Hi Maria,
To plot elongation of bar elements versus the number of elements or the size of the elements in MATLAB, you can use the following steps:
  1. Create a vector of the number of elements or the size of the elements that you want to plot.
  2. Create a vector of the corresponding elongations for each number of elements or size of the elements.
  3. Plot the elongation versus the number of elements or size of the elements using the "plot" function.
  4. Add a logarithmic scale to the x-axis using the "set" function to see the line of error.
Here is an example code to plot the elongation of bar elements versus the number of elements:
% Define the number of elements or size of the elements
nElements = [10 20 30 40 50 60 70 80 90 100];
% Define the corresponding elongations
elongation = [0.0032 0.0016 0.0011 0.0008 0.0006 0.0005 0.0004 0.0003 0.0003 0.0002];
% Plot the elongation versus the number of elements
figure;
plot(nElements, elongation, '-o');
% Set logarithmic scale on the x-axis
set(gca, 'XScale', 'log');
% Add title and axis labels
title('Elongation vs. Number of Elements');
xlabel('Number of Elements');
ylabel('Elongation');
You can modify the code to plot the elongation versus the size of the elements by replacing the "nElements" vector with a vector of the corresponding sizes of the elements.
Thank You

Categories

Find more on Interpolation in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!