Why i am getting an empty plot?

Technical Source
2 min readJan 12, 2023

%% i have this 4x18 matrix, and i want to plot the function resulting from each coloumn vs the number of coloumn

N = [1.551e-5 0.0011 0.0011 0.0011 0.0011 0.0011 0.0011 0.0011 9.6105e-4 0.0011 0.0011 0.0011 0.0011 0.0011 0.0011 0.0011 0.0011 0.0011;
0.0062 0.0061 0.0061 0.0060 0.0061 0.0060 0.0062 0.0061 0.0061 0.0062 0.0063 0.0062 0.0061 0.0051 0.0051 0.0055 0.0062 0.0062;
1.849e-5 2.3555e-4 7.1714e-4 0.0010 9.6128e-4 1.353e-4 4.1244e-4 1.9515e-4 1.3432e-4 4.9407e-4 1.6306e-4 8.6313e-4 5.9316e-4 3.4377e-4 2.2194e-4 2.8530e-4 8.2608e-4 7.0808e-4;
0.005 0.0035 0.0069 0.006 0.0069 0.0029 0.0055 0.0030 0.0029 0.0055 0.0035 0.0059 0.0044 0.0045 0.0034 0.0032 0.0049 0.0067];
for i=1:18
Cc= N(1,i);
Cf= N(2,i);
Lc= N(3,i);
Lf= N(4,i);
R = 50;
DutyC=0.76;
Vo=500;
s=tf('s');
dp = 1-DutyC;
w1 = -Lc;
w2 = dp*R;
u1 = Lc*Cc*R;
u2 = Lc;
u3 = (dp^2)*R;
x1 = Lf*Cf*(Lc^2)*dp*R*Cc;
x2 = (Lf+Lc*dp*R-(dp^2)*R*Lf*Cf)*Lc*Cc+(Lc^2)*Lf*Cf*dp*R;
x3 = (Lf+Lc*dp*R-(dp^2)*R*Lf*Cf)*Lc+Lf*Cf*Lc*(dp^3)*(R^2);
x4 = (Lf+Lc*dp*R-(dp^2)*R*Lf*Cf)*(dp^2)*R-(dp^2)*R*Lc;
x5 = -(dp^4)*(R^2);
y1 = Lc*Cc*Lf*Cf;
y2 = Lc*Cc + Lc*Lf*Cf;
y3 = Lc+Lf+Lf*Cf*(dp^2)*R;
y4 = R*(dp^2);
Gvd = (Vo*(s*w1 + w2)*((s^4)*x1+(s^3)*x2+(s^2)*x3+s*x4+x5))/(dp*((s^2)*u1+s*u2+u3)*((s^3)*y1+(s^2)*y2+s*y3+y4));
w = logspace(-1,3,100);
H = freqresp(Gvd,w);
objective = -20*log(abs(H));
g = min(objective);
plot(i,g)
end

NOTE:-

Matlabsolutions.com provide latest MatLab Homework Help,MatLab Assignment Help , Finance Assignment Help for students, engineers and researchers in Multiple Branches like ECE, EEE, CSE, Mechanical, Civil with 100% output.Matlab Code for B.E, B.Tech,M.E,M.Tech, Ph.D. Scholars with 100% privacy guaranteed. Get MATLAB projects with source code for your learning and research.

You get an empty plot because you are plotting one point at a time (g and i are scalars). A line with one point doesn’t show up without a data marker. To get a non-empty plot, use a data marker, or (better) collect the values of g in a vector and plot them together after the loop:

g = zeros(1,18); % pre-allocate vector g
N = [1.551e-5 0.0011 0.0011 0.0011 0.0011 0.0011 0.0011 0.0011 9.6105e-4 0.0011 0.0011 0.0011 0.0011 0.0011 0.0011 0.0011 0.0011 0.0011;
0.0062 0.0061 0.0061 0.0060 0.0061 0.0060 0.0062 0.0061 0.0061 0.0062 0.0063 0.0062 0.0061 0.0051 0.0051 0.0055 0.0062 0.0062;
1.849e-5 2.3555e-4 7.1714e-4 0.0010 9.6128e-4 1.353e-4 4.1244e-4 1.9515e-4 1.3432e-4 4.9407e-4 1.6306e-4 8.6313e-4 5.9316e-4 3.4377e-4 2.2194e-4 2.8530e-4 8.2608e-4 7.0808e-4;
0.005 0.0035 0.0069 0.006 0.0069 0.0029 0.0055 0.0030 0.0029 0.0055 0.0035 0.0059 0.0044 0.0045 0.0034 0.0032 0.0049 0.0067];
for i=1:18
Cc= N(1,i);
Cf= N(2,i);
Lc= N(3,i);
Lf= N(4,i);
R = 50;
DutyC=0.76;
Vo=500;
s=tf('s');
dp = 1-DutyC;
w1 = -Lc;
w2 = dp*R;
u1 = Lc*Cc*R;
u2 = Lc;
u3 = (dp^2)*R;
x1 = Lf*Cf*(Lc^2)*dp*R*Cc;
x2 = (Lf+Lc*dp*R-(dp^2)*R*Lf*Cf)*Lc*Cc+(Lc^2)*Lf*Cf*dp*R;
x3 = (Lf+Lc*dp*R-(dp^2)*R*Lf*Cf)*Lc+Lf*Cf*Lc*(dp^3)*(R^2);
x4 = (Lf+Lc*dp*R-(dp^2)*R*Lf*Cf)*(dp^2)*R-(dp^2)*R*Lc;
x5 = -(dp^4)*(R^2);

SEE COMPLETE ANSWER CLICK THE LINK

--

--

Technical Source

Simple! That is me, a simple person. I am passionate about knowledge and reading. That’s why I have decided to write and share a bit of my life and thoughts to.