I wrote a function which is pretty simple but when I call it gives errors

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)

v = displacement(x, 0, 0, 0, 0.0741, 800)
plot(x, v)

2 Comments

I have tried this as well but still following occurs
Please post your revised code for Untitled.m

Sign in to comment.

Categories

Find more on Get Started with MATLAB in Help Center and File Exchange

Asked:

on 30 May 2017

Commented:

on 30 May 2017

Community Treasure Hunt

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

Start Hunting!