How do i make plot like this?

6 Ansichten (letzte 30 Tage)
wojtek gierek
wojtek gierek am 10 Nov. 2020
Bearbeitet: Jon am 10 Nov. 2020
x ∈ [0, 10]
a = 2 b = 4

Akzeptierte Antwort

Jon
Jon am 10 Nov. 2020
Bearbeitet: Jon am 10 Nov. 2020
You must first make a matlab function or script to evaluate your y(x) and then plot your values
So something like
% define constants (put your values here)
a =
b =
x = linspace(0,10) % makes x values
y = zeros(size(x)) % preallocate y value
% loop to evaluate y
for k = 1:length(x)
if x(k) > b + a
y(k) = 1
elseif x(k) >= b - a
% and so on
end
end
% finally plot your values
plot(x,y)
  1 Kommentar
Jon
Jon am 10 Nov. 2020
Bearbeitet: Jon am 10 Nov. 2020
If you are not familiar with how to code in MATLAB please complete the MATLAB On Ramp training, https://www.mathworks.com/learn/tutorials/matlab-onramp.html then make an attempt to write your code and you can get lots of help here (MATLAB Answers) with your specific coding questions

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Graphics Performance finden Sie in Help Center und File Exchange

Tags

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by