how do i plot the output with constant input

6 visualizzazioni (ultimi 30 giorni)
grace lim
grace lim il 15 Feb 2022
Commentato: Atsushi Ueno il 25 Feb 2022
This is my code:
y=Vonew %i get my Voutnew=45
plot( y, 'b-', 'LineWidth', 2);
xlabel('vin', 'FontSize', 20);
ylabel('vo', 'FontSize', 20);
title('vo vs vin', 'FontSize', 20);
I'm trying to plot vo vs vin, subing in vin=30 and vonew=45
Thank you in advance.
  1 Commento
grace lim
grace lim il 16 Feb 2022
how do i plot 2 different point on the same line?
vin=0 vonew=0
vin=30 y=voutnew %vonew=45 from calculation
thank you in advance

Accedi per commentare.

Risposte (2)

Atsushi Ueno
Atsushi Ueno il 15 Feb 2022
Modificato: Atsushi Ueno il 25 Feb 2022
scatter function or yline function will match to your requirement.
x = [10 20 30 40 50]; y = [45 45 45 45 45]; %i get my Voutnew=45
scatter(x, y, 100, 'red', 'filled'); % to plot red filled circle at (30,45)
yline(y, 'b-', 'LineWidth', 2); % to draw a line at (:,45)
xlabel('vin', 'FontSize', 20);
ylabel('vo', 'FontSize', 20);
title('vo vs vin', 'FontSize', 20);
  3 Commenti
grace lim
grace lim il 16 Feb 2022
how do i plot 2 different points for example vin=30 and vin=10 and also v1new on the same line using the similar code?
Atsushi Ueno
Atsushi Ueno il 25 Feb 2022
Instead of scalar values, you can input vector values x and vector y to scatter function. I have changed the answer above.

Accedi per commentare.


Arif Hoq
Arif Hoq il 15 Feb 2022
Vonew=45;
vin=30;
y=Vonew; %i get my Voutnew=45
plot( vin,y, 'o', 'LineWidth', 2);
xlabel('vin', 'FontSize', 20);
ylabel('vo', 'FontSize', 20);
title('vo vs vin', 'FontSize', 20);
  4 Commenti
Arif Hoq
Arif Hoq il 16 Feb 2022
2 different points..
Vonew=[45,50];
vin=30;
y=Vonew; %i get my Vonew=45
plot( vin,y,'o','Color','red','MarkerSize',10,'MarkerFaceColor','b','LineWidth', 2);
xline(vin, 'g', 'LineWidth', 2); % to draw a Vertical line with constant x-value
xlabel('vin', 'FontSize', 20);
ylabel('vo', 'FontSize', 20);
title('vo vs vin', 'FontSize', 20);
Arif Hoq
Arif Hoq il 16 Feb 2022
Modificato: Arif Hoq il 16 Feb 2022
or
Vonew=45;
vin=30;
y=Vonew; %i get my Vonew=45
x1=25;
y1=55;
% plot( vin,y,'o','Color','red','MarkerSize',10,'MarkerFaceColor','b','LineWidth', 2);
plot( vin,y,'o',x1,y1,'*','Color','red','MarkerSize',10,'MarkerFaceColor','b','LineWidth', 2);
xlim([15 40])
xline(vin, 'g', 'LineWidth', 2); % to draw a Vertical line with constant vin-value
xline(x1, 'b', 'LineWidth', 2); % to draw a Vertical line with constant x1-value
xlabel('vin', 'FontSize', 20);
ylabel('vo', 'FontSize', 20);
title('vo vs vin', 'FontSize', 20);
if you want to draw a Vertical line with constant x-value, use xline
if you want to draw a Vertical line with constant y-value, use yline

Accedi per commentare.

Categorie

Scopri di più su Labels and Annotations in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by