drawing a triangular wave

20 visualizzazioni (ultimi 30 giorni)
soloby
soloby il 8 Giu 2015
Risposto: Image Analyst il 9 Giu 2015
hey guys, what would be the best way to draw a triangular wave?
I just need one triangular wave so my attempt was to draw the left side of the peak of something like y = 2x -8
and right side y = -2x + 8 or something and combine the two, but then I dont know how to make that into one function or graph?

Risposta accettata

Salaheddin Hosseinzadeh
Salaheddin Hosseinzadeh il 8 Giu 2015
Hi Soloby,
You just asked a question on fuzzy logic, I assume this is in the same area!
Have you tried trimf or trapmf membership functions?
  5 Commenti
Salaheddin Hosseinzadeh
Salaheddin Hosseinzadeh il 8 Giu 2015
Modificato: Salaheddin Hosseinzadeh il 8 Giu 2015
you made a mistake defining x
x = 1:0.1:10
not
x = 0:10:0.1 % this is wrong
soloby
soloby il 8 Giu 2015
you're completely right. thank you. I'll ask more on the other question we've been threading. thanks!

Accedi per commentare.

Più risposte (1)

Image Analyst
Image Analyst il 9 Giu 2015
See my attached demo
% Creates triangle waves two ways, one using repmat() and
% one using sawtooth() from the Signal Processing Toolbox.

Categorie

Scopri di più su Fuzzy Logic Toolbox 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