How to plot magnitude vs length from magnitude vs time plot

1 view (last 30 days)
I have the magnitude (amplitude) vs time Y.X values obtained.
I would like to know how can I plot magnitude vs length of the specimen in which I have obtained these signals?
  4 Comments
Ramesh Bala
Ramesh Bala on 5 Mar 2021
Or is there a way to plot wavenumber vs magnitude from it?

Sign in to comment.

Accepted Answer

William Rose
William Rose on 6 Mar 2021
If your strain versus time data is in a matrix e which is Nx6 (i.e. a column for each length, and N time points=N rows), then do this:
delamL=[5 10 20 30 40 50];
emax=max(e);
plot(delamL,emax);
If your matrix e is 6xN (a row for each length), then replace the second line with emax=max(e');
Here is an example of what I mean.
%BalaCode.m WCR 20210305
%Make some data like K. Bala's data
t=[0:.01:6]*1e-5;
e=zeros(length(t),6);
e(200:end,1)=12.5*cos(1.3e6*t(200:end) ).*(sin((t(200:end)-2e-5)*7.8e4)).^2;
e(200:end,2)=11.8*cos(1.3e6*t(200:end)+pi/2).*(sin((t(200:end)-2e-5)*7.8e4)).^2;
e(200:end,3)= 8*cos(1.3e6*t(200:end)-pi/2).*(sin((t(200:end)-2e-5)*7.8e4)).^2;
e(200:end,4)= 6.2*cos(1.3e6*t(200:end)+pi ).*(sin((t(200:end)-2e-5)*7.8e4)).^2;
e(200:end,5)= 7.2*cos(1.3e6*t(200:end)+pi/3).*(sin((t(200:end)-2e-5)*7.8e4)).^2;
e(200:end,6)= 8.2*cos(1.3e6*t(200:end)-pi/3).*(sin((t(200:end)-2e-5)*7.8e4)).^2;
%Make a plot like K. Bala's first plot
plot(t,e(:,1),'r-',t,e(:,2),'g-',t,e(:,3),'b-',t,e(:,4),'c-',t,e(:,5),'m-',t,e(:,6),'y-');
xlabel('Time (s)'); ylabel('Strain');
legend('5','10','20','30','40','50');
%Now the code to make the plot which K. Bala requested:
%Plot peak strain vs. delamination length
delamL=[5 10 20 30 40 50];
emax=max(e);
figure;
plot(delamL,emax,'k.-');
xlabel('Delam.Length (mm)'); ylabel('Max.Strain');
If using this forum in the future, I recommend supplying a short example of the kind of data you are working with, because it makes it a lot easier for others to assist you.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by