Rectangle wave in MATLAB App Designer

1 Ansicht (letzte 30 Tage)
Tejas Mahajan
Tejas Mahajan am 23 Nov. 2020
Kommentiert: Tejas Mahajan am 25 Nov. 2020
I'm using App designer for plotting rectangular graph for the points inputed by the user. For EX- if user give values for Yaxis as 1 , 2 ,4 , 5 and 2, 4, 1 , 3 for the Xaxis corresponding to the values of Yaxis. From this given data how can i plot rectangular graph for this given 4 points in MATLAB App Designer.
Please Help.
  2 Kommentare
Mario Malic
Mario Malic am 23 Nov. 2020
See line and rectangle.
Tejas Mahajan
Tejas Mahajan am 23 Nov. 2020
?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Ameer Hamza
Ameer Hamza am 23 Nov. 2020
First convert the given points in the correct order for drawing a polygon
x = [2, 4, 1, 3];
y = [1, 2, 4, 5];
pts = [x(:) y(:)];
idx = boundary(pts);
pts = pts(idx, :);
Then either use plot() or patch()
plot(pts(:,1), pts(:,2))
% or
patch(pts(:,1), pts(:,2), 'r')
  2 Kommentare
Tejas Mahajan
Tejas Mahajan am 25 Nov. 2020
This produces a Recatngle shape. i want graph of this type ->
Tejas Mahajan
Tejas Mahajan am 25 Nov. 2020
t = app.EntertheSignalEditField.Value;
t1 = str2double(strsplit(t));
x = 1 :numel(t1);
thats how im going to take values for Y axis from user and print it
user will be giving values in this format - 1 2 3 4 (using space not comma)

Melden Sie sich an, um zu kommentieren.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by