MATLAB: How can i display a funtion dependenet to x matlab function Hi How can i can i display f with values in function of x ? L=3; sol(1)=2; psi=1; f (x) = @(x) cos ( (sol(1)/L) *x)- cosh( (sol(1)/L) *x)+ psi *( sin( (sol(1)/L) *x)- sinh( (sol(1)/L) *x)); Best Answer This works:L=3;sol(1)=2;psi=1;f = @(x) cos ( (sol(1)/L) *x)- cosh( (sol(1)/L) *x)+ psi *( sin( (sol(1)/L) *x)- sinh( (sol(1)/L) *x));x = linspace(-10, 10);figure(1)plot(x, f(x))gridxlabel('x')ylabel('f(x)')See the documentation for the linspace function to understand how to change the limits and number of elements in the ‘x’ vector. Related SolutionsMATLAB: Getting an error “INDEX OUT OF BOUNDS” in the matlab program. Please help. for i=1:3 fepsn(i)=i; % (i) was added to avoid overwriting of the variable end MATLAB: How can i determine the analytical expression of the derived funtion “df(x)/dx” Use the Symbolic Math Toolbox:syms x L=sym(3);sol(1)=sym(2);psi=sym(1);f (x) = cos ( (sol(1)/L) *x)- cosh( (sol(1)/L) *x)+ psi *( sin( (sol(1)/L) *x)- sinh( (sol(1))));df_dx = diff(f,x)df_dx_fcn = matlabFunction(df_dx)df_dx(x) =(2*cos((2*x)/3))/3 - (2*sin((2*x)/3))/3 - (2*sinh((2*x)/3))/3df_dx_fcn = @(x) cos(x.*(2.0./3.0)).*(2.0./3.0)-sin(x.*(2.0./3.0)).*(2.0./3.0)-sinh(x.*(2.0./3.0)).*(2.0./3.0) Related QuestionHow to rectify this errorPlotting a piecewise FunctionIs the word “and” coming up in the outputHow to organise the codeI cant get this plot to work please help me :(Create a function to calculate hyperbolic’s then graph themHi all, I am trying to solve a fourth order differential equation using bvp4c.Below is the code.Can anyone help me to find the mistake in the code for which matlab is showing the following error?Thanks you
Best Answer