I wrote a function which is pretty simple but when I call it gives errors
Show older comments
FUNCTION CODE:
function [v]=displacement(x,d_1,d_2,phi_1,phi_2,L)
a=[(2/L^3)*(d_1-d_2)+(1/L^2)*(phi_1+phi_2)].*x.^3;
b=[(-3/L^2)*(d_1-d_2)-(1/L)*(2*phi_1+phi_2)].*x.^2;
c=phi_1+d_1;
[v]=a+b+c
MATLAB CODE:
%DATA
d_1=0,d_2=0,phi_1=0,phi_2=0.0741;L=800;
x=[0:10:800];
v=@displacement([0:10:800];0;0;0;0.0741;800)
fplot(v,x)
xlabel('Position Along Length');
ylabel('Displacement Function');
Answers (1)
Walter Roberson
on 30 May 2017
v = displacement(x, 0, 0, 0, 0.0741, 800)
plot(x, v)
2 Comments
Asim Gillani
on 30 May 2017
Walter Roberson
on 30 May 2017
Please post your revised code for Untitled.m
Categories
Find more on Get Started with MATLAB in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!