Jump to content
Wikibooks The Free Textbook Project

MATLAB Programming/Semilog

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


Note that this page is a copy of the ControlTheoryPro.com page on semilogx/y commands.

Introduction

[edit | edit source ]

The semilogx or semilogy commands plot data with 1 axis linear and the other axis log scale. The semilogx command plots the data on the x-axis on a log scale. For controls this is particularly useful when manually creating a bode plot.

Bode Plots

[edit | edit source ]

The MATLAB bode plot is very convenient but when the plot needs to be formatted then the bode command makes this difficult. As a result this author (Gabe 13:30, 20 April 2008 (CDT)) creates bode plots using the following commands

freqVec=logspace(-1,3,5000);
[mag,phs]=bode(sys,freqVec*(2*pi));
mag=db(mag(:));
phs=phs(:);
figure;
subplot(2,1,1)
semilogx(freqVec,mag)
gridon
title('System Bode Plot')
ylabel('Magnitude (dB)')
subplot(2,1,2)
semilogx(freqVec,phs)
gridon
ylabel('Phase (deg)')
xlabel('Frequency (Hz)')
[edit | edit source ]

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