CAD/matlab

Advertisement


Question
How can i create triangular and square function graphs

Answer
You can use the plot command in the form of plot(x_vector,y_vector), where x_vector is a vector of xi values and y_vector is a vector of yi values corresponding to xi. thus you must select each point you want to plot and then find its x,y value and put it in the vector.
Example:
plot a single triangle.
First vertex is a x=0, second is at x=10 and third is at x=20. Thus, x_vector=[0,10,20];
The y value of the first vertex is y=0, the second is y=15 and the third is y=0, so y_vector=[0 15 0];
To plot the triangle use plot(x_vector,y_vector) and you will see a triangle with one edge laying on the x-axis.
Square waves are plotted using a similar position. I believe that matlab already has functions that produce triangular and square signals. Check the help page.

Best
G.

CAD

All Answers


Answers by Expert:


Ask Experts

Volunteer


George Moustris

Expertise

I have extensive experience in MATLAB which is a CAD for engineers.I can answer many questions on the programming script as well as the use of many toolboxes Matlab uses.However DO NOT ask me about the underlying theory of your projects.I will only answer questions regarding the USE of Matlab.

Experience

I have written many scripts in Matlab utilizing many toolboxes and libraries such as Fuzzy Logic toolbox,Neural Nets,Image processing,Wavelets,Signal processing etc.

Organizations
Aristotle University of Thessaloniki

©2012 About.com, a part of The New York Times Company. All rights reserved.