- Create a vector of the number of elements or the size of the elements that you want to plot.
- Create a vector of the corresponding elongations for each number of elements or size of the elements.
- Plot the elongation versus the number of elements or size of the elements using the "plot" function.
- Add a logarithmic scale to the x-axis using the "set" function to see the line of error.
How to plot elongation of bar elements vs number of elements or size of elements?
1 view (last 30 days)
Show older comments
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. ![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1302910/image.jpeg)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1302910/image.jpeg)
0 Comments
Answers (1)
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:
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
See Also
Categories
Find more on Bar Plots 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!