Clear Filters
Clear Filters

How to connect the plot point using a line in Matlab using For loop for the below mentioned code??

1 view (last 30 days)
v=89.2/60;
l=0.313;
t=0.05;
strain=0.0003537;
step = 0.001;
for i = 0.001 : step : t
i_t=i;
Q_out = (v*i_t)/abs((1-strain));
strain = Q_out;
disp(strain)
plot(i_t,Q_out,'.');
hold on
end

Accepted Answer

Dyuman Joshi
Dyuman Joshi on 11 Dec 2023
Best to allocate the data in an array first and then plot -
v=89.2/60;
l=0.313;
t=0.05;
strain=0.0003537;
step = 0.001;
i_t = 0.001 : step : t;
Q_out = zeros(size(i_t));
for k = 1:numel(i_t)
Q_out(k) = (v*i_t(k))/abs((1-strain));
strain = Q_out(k);
end
figure
plot(i_t, Q_out, '-.')

More Answers (0)

Categories

Find more on Stress and Strain in Help Center and File Exchange

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!