fplot showing different curve to plot
Show older comments
Hey there! I tried plotting a simple function using two ways:
- By creating an anonymous function and using fplot() to produce the plot
- By simply creating a normal function and using plot() to produce the plot
Here's the code for the first:
clear all
close all
clc
M = 100;
p_b = 2;
Q = @(p_a) M./(p_a + p_b);
figure(1)
fplot(Q, [0 35])
ylim([0 30])
xlim([0 25])
Here's the code for the second:
clear all
close all
clc
M = 100;
p_b = 2;
p_a = [0:0.1:35];
Q = M./(p_a+p_b);
figure(2)
plot(Q,p_a)
ylim([0 30])
xlim([0 25])
The curves look identical but they're actually different if you use the data tips on the figures and compare them (see photo below)

Anyone know why this is? I'm a bit lost :(
Accepted Answer
More Answers (0)
Categories
Find more on Line 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!