change the origin of a graph

13 Ansichten (letzte 30 Tage)
Cem Eren Aslan
Cem Eren Aslan am 9 Nov. 2021
Beantwortet: Phong am 28 Mai 2023
Hi,
I want to draw a graph and its origin must be in the upper left corner of output. The numbers should increase positively down the y-axis. How can I do this?
Thanks

Akzeptierte Antwort

Sulaymon Eshkabilov
Sulaymon Eshkabilov am 9 Nov. 2021
x = 1:13; y = 2*x+3;
plot(x, y, 'r*--'), grid on
set(gca, 'YDir','reverse'), xlabel('x'), ylabel('y')

Weitere Antworten (1)

Phong
Phong am 28 Mai 2023
% I'm Nguyen Tien Phong, Hung Yen University of Technical Education
%This is an application program to plot multiple graphs on the same axes
%You guys edit it to be beautiful and suitable for multi-paragraph math problems
%Ngtienphong126@gmail.com
%Good luck
clear all
syms z
y1=3*z^3+2 % Ve tu 0 den 10 Plot this graph from 0 to 10; starting position is 0
y2=3*z^4+2*z^2+6 % Ve tu 10 den 25 (0-10-10-15) Plot this graph from 0 to 15; starting position is 10
L1=10
L2=15
Xtong=linspace(0,L1+L2,20) % Chia thanh 20 doan boi 20 diem de cbi ve cho tat ca
Yt=zeros(1,20)% Tao ra de ve cac diem chia tren z cua tat ca cac doan i
X2=linspace(0,L1,100); % Chia doan 1 thanh 100 diem de ve do thi cho doan 1
A2=subs(y1,z,X2) % Nhan gia tri tai 100 diem de ve do thi cho doan 1
plot(Xtong,Yt,'Linewidth',1) % X tong la tong chieu dai de xac dinh chieu dai truc Z khi ve
hold on
plot(X2,A2,'g','Linewidth',4) % Do thi doan 1
Xve2=linspace(10,25,100); % Chia thanh 100 diem cho doan i=2 tro di
XXX2=linspace(0,L2,100)
B2=subs( y2,z,XXX2) % Nhan 100 gia tri de ve duong do thi
plot(Xve2,B2,'r','Linewidth',4); % Ve do thi
xlabel('Duong truc Z');
title(['Bieu do Nz ', ': kN'])

Kategorien

Mehr zu Networks 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!

Translated by