MATLAB Answers

How to plot energy v/s displacement graph if I have force v/s displacement graph with 25000 values?

3 views (last 30 days)
abhilashdbire
abhilashdbire on 18 Jun 2015
Commented: abhilashdbire on 18 Jun 2015
I am using these lines to generate the value of Energy(E).
x=[1 2 3 4];
F=[ 12 45 78 45]; %i have 25000 such values
xx=x;
FF=F;
plot(x,F)
en=numel(x);
E=zeros(en);
for i=1:en
for j=en:i
xx(:, j) = [];
FF(:, j) = [];
end
E(i)=trapz(xx,FF);
end
E;
plot(x,E)
title('Energy v/s Displacement')
ylabel('Energy')
xlabel('Displacement')
First of all this is taking a lot of time and I have to press 'ctrl+C' almost all the time. There is some error in program at line E=zeros(en) I dont know how is E getting converted to double?
thanks for ur ans

  1 Comment

abhilashdbire
abhilashdbire on 18 Jun 2015
Index of element to remove exceeds matrix dimensions.
Error in force_enrgy_disp (line 51849) xx(:, j) = [];
This is the error I am getting

Sign in to comment.

Answers (0)

Community Treasure Hunt

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

Start Hunting!