MATLAB: How to find it mathematicsMATLABnumerical integration how can I find f(-0,3) on matlab? Best Answer There is not just one answer: it depends upon what model function you usex = [-0.4, 0, 0.4, 0.8, 1.2]x = 1×5 -0.4000 0 0.4000 0.8000 1.2000 fx = [-0.204, -0.07, -0.006, 0.442, 1.658]fx = 1×5 -0.2040 -0.0700 -0.0060 0.4420 1.6580 fx03 = interp1(x, fx, -0.3)fx03 = -0.1705fx03s = interp1(x, fx, -0.3, 'spline')fx03s = -0.1382p3 = polyfit(x, fx, 3);fx03p3 = polyval(p3, -0.3)fx03p3 = -0.1427The cubic fit looks pretty good. Related SolutionsMATLAB: How to define a special function with some points You can use interp1()x = [0.2 0.4 0.5 0.6 0.7 0.8 1];y = [1.42007 1.88124 2.12815 2.38676 2.65797 3.94289 3.55975];f = @(xq) interp1(x, y, xq);Then you can also evaluate in for in-between points>> f(0.2)ans = 1.4201>> f(0.3)ans = 1.6507>> f(0.55)ans = 2.2575 MATLAB: Inverse evaluation – Find x value for a y value Use interp1. Read about it.x=[0 0.038 0.0785 0.168 0.272 0.395 0.539]; y=[0 0.005 0.01 0.02 0.03 0.04 0.05]; interp1(y,x,0.025) Related QuestionSpatial toolbox robot modelPlotting a smooth curve from pointsCreating a new matrix based on the data from other two matricesHow to separate signals with diffrent frequencies
Best Answer