Skip to content

Instantly share code, notes, and snippets.

@hmurraydavis
Last active August 29, 2015 14:00

Revisions

  1. hmurraydavis revised this gist May 4, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion calculateElasticModulusInstron.m
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    function calculateElasticModulusInstron(x,y)
    %%%% Compute the elastic modulus from experamental data.
    %%%% INPUT VARIABLE DEF: x=load of sample from experamental data,
    %%%% %% y=elongation of sample from experamental data.
    %%%% y=elongation of sample from experamental data.

    %%prep matlab environment:
    clc; clf;
  2. hmurraydavis revised this gist May 4, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion calculateElasticModulusInstron.m
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    function calculateElasticModulusInstron(x,y)
    %%%% Compute the elastic modulus from experamental data.
    %%%% INPUT VARIABLE DEF: x=load of sample from experamental data,
    %% y=elongation of sample from experamental data.
    %%%% %% y=elongation of sample from experamental data.

    %%prep matlab environment:
    clc; clf;
  3. hmurraydavis revised this gist May 4, 2014. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion calculateElasticModulusInstron.m
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,7 @@
    function calculateElasticModulusInstron(x,y)
    %%%% Compute the elastic modulus from experamental data.
    %%%% INPUT VARIABLE DEF: x=load of sample from experamental data, y=elongation of sample from experamental data.
    %%%% INPUT VARIABLE DEF: x=load of sample from experamental data,
    %% y=elongation of sample from experamental data.

    %%prep matlab environment:
    clc; clf;
  4. hmurraydavis revised this gist May 4, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion calculateElasticModulusInstron.m
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    function calculateElasticModulusInstron(x,y)
    %%%% Compute the elastic modulus from experamental data.
    %%%$ INPUT VARIABLE DEF: x=load of sample from experamental data, y=elongation of sample from experamental data.
    %%%% INPUT VARIABLE DEF: x=load of sample from experamental data, y=elongation of sample from experamental data.

    %%prep matlab environment:
    clc; clf;
  5. hmurraydavis revised this gist May 4, 2014. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions calculateElasticModulusInstron.m
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,9 @@
    function calculateElasticModulusInstron(x,y)
    %%%% Compute the elastic modulus from experamental data.
    %%%$ Arity: 2, INPUT VARIABLE DEF: x=load of sample from experamental data, y=elongation of sample from experamental data.
    %%%$ INPUT VARIABLE DEF: x=load of sample from experamental data, y=elongation of sample from experamental data.

    %%prep matlab environment:
    clc;
    clc; clf;

    %% Define length of the slope which you want to calculate Elastic Modulus for:
    lengths1 = 300:1800;
  6. hmurraydavis revised this gist May 4, 2014. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions calculateElasticModulusInstron.m
    Original file line number Diff line number Diff line change
    @@ -6,10 +6,11 @@ function calculateElasticModulusInstron(x,y)
    clc;

    %% Define length of the slope which you want to calculate Elastic Modulus for:
    lengths1=300:1800;
    lengths1 = 300:1800;

    %% Select input data:
    x=x(lengths1); y=y(lengths1);
    x = x(lengths1);
    y = y(lengths1);

    %Best fit line math:
    p = polyfit(x,y,1); % p returns 2 coefficients fitting r = a_1 * x + a_2
  7. hmurraydavis revised this gist May 4, 2014. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions calculateElasticModulusInstron.m
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,7 @@
    function calculateElasticModulusInstron(x,y)
    %%%% Compute the elastic modulus from experamental data.
    %%%$ Arity: 2, INPUT VARIABLE DEF: x=load of sample from experamental data, y=elongation of sample from experamental data.

    %%prep matlab environment:
    clc;

    @@ -8,8 +11,6 @@ function calculateElasticModulusInstron(x,y)
    %% Select input data:
    x=x(lengths1); y=y(lengths1);



    %Best fit line math:
    p = polyfit(x,y,1); % p returns 2 coefficients fitting r = a_1 * x + a_2
    r = p(1) .* x + p(2); % compute a new vector r that has matching datapoints in x
  8. hmurraydavis revised this gist Apr 26, 2014. 1 changed file with 19 additions and 15 deletions.
    34 changes: 19 additions & 15 deletions calculateElasticModulusInstron.m
    Original file line number Diff line number Diff line change
    @@ -1,19 +1,23 @@
    %%prep matlab environment:
    clc;
    function calculateElasticModulusInstron(x,y)
    %%prep matlab environment:
    clc;

    %% Select input data:
    x=String1_Extension(lengths1); y=String1_Load(lengths1);
    %% Define length of the slope which you want to calculate Elastic Modulus for:
    lengths1=300:1800;

    %% Select input data:
    x=x(lengths1); y=y(lengths1);

    %% Define length of the slope which you want to calculate Elastic Modulus for:
    lengths1=300:1800;

    %Best fit line math:
    p = polyfit(x,y,1); % p returns 2 coefficients fitting r = a_1 * x + a_2
    r = p(1) .* x + p(2); % compute a new vector r that has matching datapoints in x

    %% now plot both the points in y and the curve fit in r
    plot(x, y, 'x'); % raw data
    hold on;
    plot(x, r, 'r-','LineWidth',4.3); % calculated line of best fit
    hold off;
    ElasticModulus=p(1) %print elastic modulus (slope)
    %Best fit line math:
    p = polyfit(x,y,1); % p returns 2 coefficients fitting r = a_1 * x + a_2
    r = p(1) .* x + p(2); % compute a new vector r that has matching datapoints in x

    %% now plot both the points in y and the curve fit in r
    plot(x, y, 'x'); % raw data
    hold on;
    plot(x, r, 'r-','LineWidth',4.3); % calculated line of best fit
    hold off;
    ElasticModulus=p(1) %print elastic modulus (slope)
    end
  9. hmurraydavis created this gist Apr 25, 2014.
    19 changes: 19 additions & 0 deletions calculateElasticModulusInstron.m
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    %%prep matlab environment:
    clc;

    %% Select input data:
    x=String1_Extension(lengths1); y=String1_Load(lengths1);

    %% Define length of the slope which you want to calculate Elastic Modulus for:
    lengths1=300:1800;

    %Best fit line math:
    p = polyfit(x,y,1); % p returns 2 coefficients fitting r = a_1 * x + a_2
    r = p(1) .* x + p(2); % compute a new vector r that has matching datapoints in x

    %% now plot both the points in y and the curve fit in r
    plot(x, y, 'x'); % raw data
    hold on;
    plot(x, r, 'r-','LineWidth',4.3); % calculated line of best fit
    hold off;
    ElasticModulus=p(1) %print elastic modulus (slope)