Plot wont show line
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Im trying to plot these lines and it is just showing the point but not the lines for the plot any thoughts here is the code.
%output the Revenue and Total Cost plot
figure('color','w');
plot(y,Tcost,'r--','linewidth',3) ;
hold on
plot(y,revenue_cost_wpy,'linewidth',3) ;
hold on
plot(breakeven,'o k','Markerfacecolor','k');
grid on
title('Revenue and Total Cost')
xlabel('Number of Years (Y)')
ylabel('Revenue and Cost [$]')
%plot profit plot
figure('color','w')
plot(y, profit,'g-.','linewidth',2.5);
hold on
plot(breakeven,profit,'o k','Markerfacecolor','k')
grid on
title('Profit')
xlabel('Number of Years (Y)')
ylabel('Profit of the construction choice [$]')
legend('Profit','location','northwest')
1 Kommentar
Antworten (1)
Subhadeep Koley
am 5 Nov. 2019
Hi, it is difficult to provide an exact solution without your original data. However, when I executed your code with demo data, it is giving output as expected.
close all;clc;clear;
% Example data for test
y = 1:100;
Tcost = linspace(10,80,100);
revenue_cost_wpy = linspace(0,100,100);
profit = revenue_cost_wpy - Tcost;
breakeven = 32;
% Plotting
figure('color','w');
plot(y,Tcost,'r--','linewidth',3) ;
hold all;
plot(y,revenue_cost_wpy,'linewidth',3) ;
plot(y,breakeven,'o k','Markerfacecolor','k');
grid on;
title('Revenue and Total Cost');
xlabel('Number of Years (Y)');
ylabel('Revenue and Cost [$]');
legend({'Total Cost','Revenue','Breakeven'},'location','northwest');
figure('color','w');
plot(y, profit,'g-.','linewidth',2.5);
hold on;
plot(breakeven,profit,'o k','Markerfacecolor','k');
grid on;
title('Profit');
xlabel('Number of Years (Y)');
ylabel('Profit of the construction choice [$]');
legend('Profit','location','northwest');
hold off;
Check whether these kind of output is expected or not.
Hope this helps!
0 Kommentare
Siehe auch
Kategorien
Mehr zu Annotations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!