function [v] = Deflection_vmndangi(x)% Author : Vainquer Ndangi
% Date : September 22, 2019
% Purpose : Calculationg Deflection
% Inputs:
% x: position
% Outputs:
% v : Deflection
if (x > 0 & x <= 120) v = (1./(3.19 .* 10.^9)) .* (800 .* x.^3 - 13.68 .* 10.^6 .* x - 2.5 .* x.^4);endif (x > 120 & x <= 240) v = (1./(3.19 .* 10.^9)) .* (800 .* x.^3 - 13.68 .* 10.^6 .* x - 2.5 .* x.^4 + (25 .* (x - 120).^4));endif (x > 240 & x <= 360) v = (1./(3.19 .* 10.^9)) .* (800 .* x.^3 - 13.68 .* 10.^6 .* x - 2.5 .* x.^4 + (25 .* (x - 120).^4) + (600 .* (x - 240).^3));end end
every time i run this function with a single value it works. However, when i try to run it with a vector it only works if every element of the vector are under the same condition. if one element is not it will return "Output argument "v" (and maybe others) not assigned during call to "Deflection_vmndangi".". what can i do?
Best Answer