How do I output to the command window where the sum of the bars on the graph equal zero along the x axis

1 次查看(过去 30 天)
clc;
clear;
close all;
A= -15000;
A(2:6)= 3200;
A(7:9)= [2133.333, 1066.667, 1000];
n=length(A);
for i =1:n
x(i) = i-1;
end
bar(x,A,0.25)
PW= 0;
int=[1.06 1.08 1.1];
for j= 1:length(int)
PW=0;
for t= 1:n
PW=PW+A(t)*int(j)^(-x(t));
PWA(j,t)=PW;
end
end
figure(1)
hold on
plot(x,PWA,'-x','LineWidth',2)
legend('CF diagram','1.06','1.08','1.1','Location','southeast')

回答(1 个)

Star Strider
Star Strider 2019-4-23
If fyou are referring to ‘PWA’, try this (after your plot call):
for k = 1:size(PWA,1)
PWA0(k) = interp1(PWA(k,:), x, 0, 'linear', 'extrap');
fprintf('PWA = 0 at x = %4.2f\n', PWA0(k))
end
When I ran it, the result was:
PWA = 0 at x = 6.02
PWA = 0 at x = 7.47
PWA = 0 at x = 9.40
Experiment to get the result you want.

类别

Help CenterFile Exchange 中查找有关 Graphics Performance 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by