daily pastebin goal
25%
SHARE
TWEET

Untitled

a guest Jan 20th, 2019 85 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. clear;
  2.     clc;
  3.     close all;
  4.  
  5.     % u,,xx=-(f/ea) on [0,L]
  6.     % u,x(L)= R
  7.     % u(0)=0
  8.  
  9.     % Parameters
  10.     L= 1;
  11.     % Parameters in force function
  12.     A= .0001;
  13.     E= 70e9;
  14.     R= 1000;
  15.     a= 1000;
  16.     g= R/E*A;
  17.     f= @(x) ((((-1)*(a)*(x))/E*A));
  18.  
  19.     % solve analytical solution
  20.  
  21.     u1 = dsolve(['D2y = ' char(sym(f))], ['Dy(1) = ' num2str(g)], ['y(0) ='
  22.     num2str(0)] ,'x');
  23.  
  24.  
  25.     % change symbolic function to anonymous matlab function for easier
  26.     computing
  27.  
  28.     u = matlabFunction(u1);
  29.  
  30.     % plot the analytical solution
  31.     n= 20;
  32.     x = linspace(0, 1, n);
  33.     plot(x, u(x), '-ro', 'LineWidth', 4)
  34.     title('Analytical Solution u')
  35.     axis([0, 1, 0, 3])
  36.     xlabel('x')
  37.     ylabel('u')
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top