About 1,350,000 results
Open links in new tab
  1. How to plot a piecewise function on Matlab? - MATLAB Answers - MATLAB ...

    Sep 12, 2021 · Please help me to plot both functions in a single plot. Try define another function. Then "hold on"; and plot the function. Sign in to comment. Sign in to answer this question. How to plot a piecewise function on Matlab?. Learn more about plot piecewise functions.

  2. piecewise - MathWorks

    pw = piecewise(cond1,val1,cond2,val2,...) returns the piecewise expression or function pw whose value is val1 when condition cond1 is true, is val2 when cond2 is true, and so on. If no condition is true, the value of pw is NaN.

  3. matlab - Plotting piecewise function - Stack Overflow

    Aug 1, 2017 · Another way, that lets you define all kind of function specific visual properties is to use hold: f = @(t,a) a.*t; t = 0:30:100; m = 'os^'; % choosing different marker for each function for k = 1:numel(t)-1 plot(t(k):t(k+1),f(t(k):t(k+1),k),m(k)) hold on end hold off

  4. Piecewise function plot in Matlab - Mathematics Stack Exchange

    I can't seem to find out how to plot a piecewise function properly. I can get it by plotting two separate graphs and by using the hold on capability. You can always concatenate the data from your two functions before plotting.

  5. Creating Piecewise functions in MATLAB HELP NEEDED : r/matlab - Reddit

    Nov 12, 2019 · Piecewise plotting is usually done with logical indexing. That is also covered in the documentation.

  6. How to plot a piecewise function? - MATLAB Answers

    Dec 20, 2016 · The problem with your code is that when you apply an ‘if’ to an entire vector, as you have done with “if x<0”, it is not regarded as true by matlab unless all elements of that vector are true, and that of course is not the case, so the ‘if’ will fail. The same hold true with your other two if’s - they will all fail and y is never set.

  7. Usinghold on’ in MATLAB for Easier Data Visualization

    When you use the hold on function in MATLAB, it retains the current plot and certain axes properties so that subsequent graphing commands add to the existing graph. This means that you can create a new plot on the same figure without erasing the previous plot.

  8. matlab - Plotting a piecewise continuous function - Stack …

    Nov 30, 2018 · The other option, resulting in the same graph, is to plot all three of them separately using hold on: figure; hold on plot(i1,f1,'b'); plot(i2,f2,'b'); plot(i3,f3,'b'); Or use the plot(X,Y,X1,Y1,...,Xn,Yn syntax: figure; plot(i1,f1,'b',i2,f2,'b',i3,f3,'b')

  9. How to Plot a Function in MATLAB - Medium

    Nov 23, 2023 · MATLAB has multiple tools to plot a function. However, the best way is to use fplot. fplot (f, [xmin max]) lets you plot a function f (x) in the domain of xmin to xmax. We will use an example...

  10. How to plot a piecewise defined function? - MATLAB Answers

    Dec 6, 2012 · I want to plot a piecewise defined function. My Problem is, that the plot isn't right and I don't find the mistake... would be great, if somebody could help me! function CubicSpline

  11. Some results have been removed
Refresh