How to write a function that plots a graph of another function's outputs for varying inputs to that function.

1 view (last 30 days)
I need to write a function B that plots a graph of the output of a function A when one of its(A) input values varies continuously between two values (0,3) eg. When C(input value) = 0 plot output of A continuously until C = 3.

Answers (1)

Walter Roberson
Walter Roberson on 1 Dec 2015
Mathworks works in finite precision, with only a finite number of representable numbers. It is not able to vary input continuously between two numbers, because "continuously" is infinite numbers.
x = linspace(0,3,10000); %not continuous, just close together
plot(x, arrayfun(function_handle_for_a, x))

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!