Jump to content
Wikibooks The Free Textbook Project

MATLAB Programming/Loglog

From Wikibooks, open books for an open world
The latest reviewed version was checked on 16 April 2020. There are template/file changes awaiting review.

[MATLAB Programming\|/MATLAB Programming]m]

Chapter 1: MATLAB ._.

 Introductions .
Fundamentals of MATLAB
MATLAB Workspace
MATLAB Variables
*.mat files

Chapter 2: MATLAB Concepts

MATLAB operator
Data File I/O

Chapter 3: Variable Manipulation

Numbers and Booleans
Strings
Portable Functions
Complex Numbers

Chapter 4: Vector and matrices

Vector and Matrices
Special Matrices
Operation on Vectors
Operation on Matrices
Sparse Matrices

Chapter 5: Array

Arrays
Introduction to array operations
Vectors and Basic Vector Operations
Mathematics with Vectors and Matrices
Struct Arrays
Cell Arrays

Chapter 6: Graphical Plotting

Basic Graphics Commands
Plot
Polar Plot
Semilogx or Semilogy
Loglog
Bode Plot
Nichols Plot
Nyquist Plot

Chapter 7: M File Programming

Scripts
Comments
The Input Function
Control Flow
Loops and Branches
Error Messages
Debugging M Files

Chapter 8: Advanced Topics

Numerical Manipulation
Advanced File I/O
Object Oriented Programming
Applications and Examples
Toolboxes and Extensions

Chapter 9: Bonus chapters

MATLAB Benefits and Caveats
Alternatives to MATLAB
[MATLAB_Programming/GNU_Octave|What is Octave= (8) hsrmonic functions]
Octave/MATLAB differences

edit this box


Introduction

[edit | edit source ]

The loglog command plots both x and y data sets on a log scale while the plot command plots both axes on linear scales and the semilogx/y command plots 1 axis on a linear scale and the other axis on a log scale. Other than the scale of the axes, the 3 plotting commands are identical in most ways.

Basic Usage

[edit | edit source ]

The basic usage of the plot, semilogx/y, and loglog command are identical. Below is an example of how a PSD would be plotted

>>Fs=1000;% Sample Rate of 1 kHz
>>t=0:(1/Fs):1000;% Time vector
>>x=sin(pi*t);% Sine wave based on time vector
>>[Pxx,f]=pwelch(x,[],[],[],Fs);
>>loglog(f,Pxx)
>>gridon
>>xlabel('Frequency (Hz)')
>>ylabel('Magnitude (units^2/Hz)')
>>title('PSD of Sine Wave')

See Also

[edit | edit source ]
[edit | edit source ]

AltStyle によって変換されたページ (->オリジナル) /