Plotting variables from an implicit function
Show older comments
d=0.2; fs=250e3; Vo=40; C=126e-12; V=425; I=75;
A1=Vo/Vdc; A2=2*fs*Io/Vdc; A3=Cp*(Vdc/Io)^2;
f = dmin - A1/n - A2*n*L*( 1+sqrt( 1-A3/(n*L) ) );
fimplicit(f,[0.1e-6 50e-6 0.01 0.5])
I am getting a blank plot after executing the above statements. Kindly let me know where I am going wrong.
Thank you.
Accepted Answer
More Answers (2)
Let's vectorize your function and see what it looks like when you plot it as a surface.
dmin=0.2; fs=250e3; Vo=40; Coss=126e-12; Vdc=425; Io=75;
Cp=2*Coss;
A1=Vo/Vdc; A2=2*fs*Io/Vdc; A3=Cp*(Vdc/Io)^2;
I changed your code to use element-wise multiplication and division rather than matrix multiplication and division. See this documentation page for more information.
f = @(L,n) dmin - A1./n - A2*n.*L.*( 1+sqrt( 1-A3./(n.*L) ) );
fsurf(f,[0.1e-6 50e-6 0.01 0.5])
What does fimplicit do? From the fimplicit documentation: "fimplicit(f) plots the implicit function defined by f(x,y) = 0 over the default interval [-5 5] for x and y." Based on this surface, I'd say that call should plot at most a handful of points and that's only if the upper-left corner of the plot actually reaches the zero plane. Does it?
f(0.1e-6, 0.5)
Yes, barely. And if you look very carefully at that corner of your fimplicit plot you'll see just a hint of a blue line. So fimplicit behaved correctly.
Hi, based on my understanding, you want to plot the equation using 'fimplicit' but this function aims to plot implicit functions and the nature of your equation might not be suitable for this approach. It seems that your equation involves both square roots and divisions, which can complicate the process of plotting it directly using 'fimplicit'.
In the following code, I've created a meshgrid of L and n values and evaluated the equation over that grid to obtain the z values. The 'surf' plot essentially visualizes the variation of the equation's value in a 3D space. Please feel free to adjust the range and number of points in the linspace calls according to your needs.
dmin = 0.2;
fs = 250e3;
Vo = 40;
Coss = 126e-12;
Vdc = 425;
Io = 75;
Cp = 2 * Coss;
A1 = Vo / Vdc;
A2 = 2 * fs * Io / Vdc;
A3 = Cp * (Vdc / Io)^2;
% Define the equation
f = @(L, n) dmin - A1 ./ n - A2 .* n .* L .* (1 + sqrt(1 - A3 ./ (n .* L)));
% Define the range of values for L and n
L_range = linspace(1e-6, 50e-6, 100); % Adjust the range and number of points
n_range = linspace(0.01, 0.5, 100); % Adjust the range and number of points
% Create a meshgrid of L and n values
[L, n] = meshgrid(L_range, n_range);
% Evaluate the equation over the meshgrid
z = f(L, n);
% Plot the equation
figure;
surf(L, n, z);
xlabel('L');
ylabel('n');
zlabel('Equation Value');
title('Plot of the Equation');
grid on;
To learn more about the above functions, please check out the MathWorks documentation links below:
Categories
Find more on Equations 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!




