What is Matlab: Definition and 1000 Discussions

MATLAB (an abbreviation of "matrix laboratory") is a proprietary multi-paradigm programming language and numeric computing environment developed by MathWorks. MATLAB allows matrix manipulations, plotting of functions and data, implementation of algorithms, creation of user interfaces, and interfacing with programs written in other languages.
Although MATLAB is intended primarily for numeric computing, an optional toolbox uses the MuPAD symbolic engine allowing access to symbolic computing abilities. An additional package, Simulink, adds graphical multi-domain simulation and model-based design for dynamic and embedded systems.
As of 2020, MATLAB has more than 4 million users worldwide. MATLAB users come from various backgrounds of engineering, science, and economics.

View More On Wikipedia.org
  1. J

    MATLAB Solving System of Equations w/MATLAB Shooting Method

    Hi all, I'm looking to solve the following system of equations with boundary conditions using the shooting method in MATLAB: F''=F^2-G^2+F'H G''=2FG+G'H H'=-2F along with the conditions F(0)=0, G(0)=1, H(0)=0, F(infinity)=0, G(infinity)=0. I've found the solution using the...
  2. S

    MATLAB How can I solve matrix problems in MATLAB using symbolic variables?

    i have 2 simple MATLAB questions first when i have two matrices the first one is empty and the second one conatins numbers i can Say A=B SO THE VALUE OF B BECOMES INSIDE A BUT MY QUESTION I JUST DEFINE SYMS EI and multiply it by B bUT When itry to put Put B in A IT DOENST WORK COULD...
  3. J

    MATLAB Help with MATLAB BVP4C: Solving Non-Newtonian Equations

    Hi all, (Don't mean to spam, meant to put this in General Math not General Engineering!) I'm running the following code in MATLAB: function M = nonNewtonian(~) M = bvpinit(linspace(0,10,301),@VKinit); sol = bvp4c(@VK,@VKbc,M); figure; hold all; plot(sol.x,sol.y(2,:))...
  4. E

    Matlab - plotting a function

    How do I plot something like (x-4)(x-5)(x-6)? I've tried: x = -6:0.01:6; y = (x-4)*(x-5)*(x-6); plot(x,y) It's giving me the error: Error using * Inner matrix dimensions must agree.
  5. R

    MATLAB Matlab: value non-zero but it should

    Hello everybody! I'm quite new with Matlab and I'm starting trying some stuff.. well I was trying to input det(a) where a=[1,2,3;4,5,6;7,8,9] and this should be zero. And I mean 0.0000 but the result is 6.6613e-16 why?O.o
  6. Z

    MATLAB Create function from a vector in matlab

    Hi everyone, Lets say i have created a column vector c = [ N x 1 ] and my time vector has the same dimensions. I want to create a function f(t) in which f(fstep) = c(cstep) where cstep is integer and fstep maybe not. ( for example f(0)=c(0), f(0.1)=c(1), ... f(10)=c(100)) As a result i...
  7. E

    MATLAB Where is my mistake in this MATLAB code?

    Hi, I am trying to plot the AN product sec II.C in the attached paper as: clear all clc s=0.5; w=0; d=5; f=0:20; NdB1=(17-30.*log10(f)); N1=10.^(NdB1./10); NdB2=40+20*(s-0.5)+26.*log10(f)-60.*log10(f+0.03); N2=10.^(NdB2./10); NdB3=50+7.5*w^0.5+20.*log10(f)-40.*log10(f+0.4)...
  8. L

    MATLAB Can the Asus EeePC X101CH handle Matlab?

    Hi, I'm thinking about getting this laptop, it's small and cheap. I hope it's good enough for doing student-level calculations in Matlab, perhaps some simple programming, surfing, writing documents in Word etc. Anyone tried Matlab on one of these? I currently have a laptop but I'm so used to...
  9. A

    MATLAB Matlab for loops involving matrix

    Given the following system of equations 3x1 + ax2 = 1 ax1 + 4x2 = 0 where -pi ≤ a ≤ pi. We would like to find out the range of values of x1 and x2 that are observed as a is varied. Do this as follows: 1. Create a for loop that uses the variable a as the indexing value, varied from over...
  10. J

    MATLAB Python equivalent of MATLAB textscan?

    Is there one? Or do I really have to write something like this: from numpy import * with open('file.txt','r') as f: #read only data, ignore headers lines = f.readlines()[31:] # convert strings to floats and put into arrays for i in xrange(len(lines)): s =...
  11. S

    Matlab: creating a table of equations using multiple variables

    Homework Statement I have an equation that looks like func=sin(pi*x*n)*sin(pi*y*m) I was wondering if there was any method (possibly involving for loops) where I could get a plottable function along xy for all the different combinations of n and m i.e. m= 1 n =1 so the function would be...
  12. S

    Matlab Question: How to assign a new name to an amended matrix

    I have to replace some matrix columns with some vectors. I am currently copying the original matrix and replacing the column of the matrix I have copied eg: matrix_1 = matrix_2 matrix_2(:,4) = vector_1 This works fine, but I was wondering if it was possible to maybe amend the original matrix...
  13. I

    Matlab Approximate the Integral Assignment

    Homework Statement Hey Everyone! So I have an assignment that says to approximate the integral f(x)=e^(3x), -1<x<3. Answer the following questions Run the code with N=10, N=100, and N=1000. For each approximation, when does the result agree with the exact value of the integral to 4 digits? How...
  14. J

    MATLAB How to simulate Op-Amp in MATLAB

    Good day. Could anyone tell me how to simulate an equivalent Operational Amplifier in Simulink? I read somewhere that I had to do it with 2 adders and a gain block, but I don't know how. Thanks.
  15. D

    MATLAB How to Implement Newton-Raphsons Method in Matlab?

    My objective is to create an applicator for the Matlab Newton-Raphsons method using only a function handle, the initial value and the number of iterations desired. I'm extremely new to Matlab and programming so bare with me for being programming deficient. My question is when making a loop, how...
  16. C

    MATLAB Differential equation for matlab

    THE PROBLEM : y(t) = e^(-t)*sin(t^2); with t0 = 0 and T = 3.14159. Find y_0, and use it to deduce the corresponding expression for f(t, y) (Your f should have both a t and a y in it. Simplify it to find the y!). This is for a MATLAB project. I've solved this differential equation (which we...
  17. R

    Matlab ode solve takes too big steps?

    Homework Statement I have a set of differential equations, which need to be solved by matlabs solvers. all of the states have to stay between 0 and 1, but they don't. I'm 100% sure my equations are right, but MATLAB is taking too big steps, causing the state to go negative or above 1. most...
  18. R

    MatLab Integration Approximations for Given Function

    Homework Statement I need to answer the attached question, but we haven't done anything similar in class and the book isn't proving to be helpful for me. I'm not sure if I have to use matlab, we were given this code but I can't even understand what it is calculating. % f(x), the function...
  19. K

    Matlab: factorials without for loops or colon

    The Problem: Write a function that finds the factorial of a positive integer without using for or while loops, the factorial function, or the : range operator. Honestly, I don't really know how to start with this one. If I were able to use a for loop it would be easy, and I don't see how I...
  20. T

    MATLAB [Matlab] Plotting a function inside a m-file?

    A3.m: %x = 0:pi/100:2*pi; %y = sin(2*x); %z = 2*cos(2*x); %plot(x,y,'k',x,z,'--b') %title('Plot of f(x)=sin(x) and it''s derivative') %xlabel('X-axis') %ylabel('Y-axis') %legend('sin(2x)','2cos(2x)') x = -2:0.01:2 y = f2(x) plot(x,y) f2.m: function F = f2(x) F(1) =...
  21. A

    MATLAB Gauss-Seidel iterval method using Matlab

    Hello. I am new in matlab. And I wonder how to solve equations using gauss-seidel iteration method. Theoreticaly I understand how this method is working, but can't get how write script in matlab. It can be great if somebody can give a explanation for this problem.
  22. L

    MATLAB Producing arrays to plot (MATLAB)

    Hi everyone, my code is a little rusty and a work in progress but I was wondering how I would go about producing arrays for the calculations performed in the while loop for the analyses so they can be plotted. I have the following parameter input; G0 = 50; v = 0.25...
  23. X

    How to Simulate and Plot a Transfer Function in MATLAB?

    Homework Statement Consider the system defined by Y(s) = H(s)X(s) with H(s) = K \frac{s-a}{(s-b)(s-c)}. Build a function in MATLAB to simulate this system for given values of a,b,c,K and various input signals x(t) (in the time or in s-domain). Include a function to display plots of the time...
  24. M

    MATLAB How Can Lifting Line Theory Be Applied in MATLAB for Aircraft Wing Design?

    Hi guys, I am studying aerospace engineering doing my final year. I am doing my final year project which is called "Development of Aircraft Wing Design Tool using MATLAB". It is basically to create a basic tool which will help a designer to design wings. I am totally confused on how to go...
  25. L

    Efficient Newton's Method in MATLAB for Solving Catenary Constants

    I'm tasked currently with creating a MATLAB function to run Newton's method. From there I need to use this function to solve for the constants of a catenary which pass through (+-50, 100). I used wolfram alpha to find the proper constant as 107.432 so I would know if I was on the right track or...
  26. D

    MATLAB Using Matlab to plot a phase potrait for ODEs

    First create the function file and name it whatever you would like. I prefer phase-portrait. % Phase Plot Program % To use this function, do the following: % >> phase_portrait(x1, x2, y1, y2, tfinal, 'F', N); for example, % >> phase_portrait(-5, 5, -5, 5, 10, 'F', 5)function [] =...
  27. E

    How i can plot anti periodic sine wave in matlab ?

    i don't know how i can use MATLAB to plot anti periodic fun .. the origin site give this code for triangular fun: fs = 10000; t = -1:1/fs:1; x1 = tripuls(t,20e-3); plot(t,x1), xlabel('Time (sec)');ylabel('Amplitude'); title('Triangular Aperiodic Pulse') but when i use this for sine...
  28. C

    Plotting Multiple Equations on One Graph in MATLAB?

    Homework Statement Does anyone know how to do this? Let's say I had the equation: f(t) = |2t, 0≤ t < 2 |(t^2)-3, 2≤t how would you plot this over 0≤ t ≤4 in Matlab? Homework Equations - The Attempt at a Solution I've tried ezplot but i can't manage getting both...
  29. C

    Plotting Fourier Functions in Matlab - Help?

    Plotting Laplace Functions in Matlab - Help? SORRY I MEANT LAPLACE FUNCTIONS Homework Statement so we have a function f(t) = |2t, 0≤ t < 2 |(t^2)-3, 2≤t how would you plot this over 0≤ t ≤4 in Matlab? Homework Equations - The Attempt at a Solution I guess you could...
  30. R

    MATLAB Nation of Tool Users? ( ex. Matlab)

    Sometimes I get the impression that employers want a. Experience in a particular software tool AND b. Specialization and this trumps everything else other than work experience. It wasn't unsual for people with no formal educational background in Computer Science to land programming jobs...
  31. L

    Lighter matlab descrete convolution software

    A while back I tended a course in transform methods. During the course we were handed a MAtlab program that could be used to simulate convotution called Discrete Convolution Demo. It's kind of big or you might say bloated and I'd like some lightweight version or something. If someone know some...
  32. G

    Question about square brackets and parentheses in MATLAB.

    I'm trying to figure out what these do in certain implementations. I can't seem to find the answer in the documentation. http://www.mathworks.com/matlabcentral/fileexchange/30580-binary-amplitude-shift-keying[1] for ii = 1:1:length(bit_stream) ASK_signal = [ASK_signal...
  33. P

    MATLAB Download MATLAB for Free - Before Uni Starts

    How can I download MATLAB for free? Uni starts soon and I want to get the program before that. Can you help me please? Thanks :)
  34. T

    MATLAB How can I isolate a segment of ECG data in MATLAB?

    I have inputed the following, I was given a signal and told to plot it in a time domain. The signal ECG is a data file and imported. N = 15000; fs = 250; t = linspace(0, 60, N); %signal = ecg data = ecg subplot (2,1,1); plot (t,ecg); title ('Time-Domain ECG') xlabel ('Time (s)') ylabel...
  35. H

    MATLAB Matlab: Butterworth Filter Bode Plot

    I'm stuck on a really simple problem because I haven't done MATLAB in a while. I have transfer functions for nth order lowpass Butterworth Filters: H(jw) = 1/(s + w_c)^n I want to plot the 1st to 5th order filters. How do I input H(jw) into matlab? The tf(num, den) is not efficient in that...
  36. J

    How Do I Correctly Plot an Electric Field Around a Base Station Using MATLAB?

    Homework Statement I need to plot an electric field in some range around base station, for example in range of 200m. EIRP=57,5dBm G=1 for the first example N=4 Homework Equations E=[2*sqrt(30*N*P*G)]/r P=10exp[(EIRP-30)/10] EIRP=57,5dBm G=1 for the first example N=4 The...
  37. S

    MATLAB MATLAB num2str: Preserving Valid Digits

    Dear Users, the topic MATLAB num2str is closed, therefore I am posting this as a reply to that thread. The suggestion by marcusl won't work for numbers of various format, but same number of valid digits. Example: The numbers 0.0056 0.0060 0.043 0.050 0.32 0.40 are valid to their...
  38. P

    Convolving a signal with its impulse response in MATLAB

    Homework Statement We're supposed to convolve the signal x[k] = u[k] - u[k-8] with its impulse response h[k] = sin(pi*k/4)*( u[k] - u[k-8] ) with the help of MATLAB. Homework Equations - The Attempt at a Solution The thing is that we don't know how to do this in MATLAB...
  39. N

    MATLAB Importing Data in MATLAB: Plotting Time vs. Third Column

    Hi. Suppose I load data from a .csv file: Blah @Blah 2Blah Blah f Blah fa Blah Blahasd Blahasda vasf Blah as Blah asdas Blah Date Time Ch1: 07/25/2012 42:46.0 96.385 07/25/2012 42:46.0 -177.608 07/25/2012 42:46.0 155.481 07/25/2012 42:46.0 64.15 an attempt would be to...
  40. C

    MATLAB Creating a MATLAB Function File Without Mod/Rem

    I need to create a MATLAB function file that will accept a modulo values (from 3 to 9; that is Z3 to Z9) and will output the least possible value describe by the modulo conditions I don't know how to start it because I am not allowed to use the mod() and rem(). Please give me an idea how to do...
  41. M

    MATLAB Matlab code natural numbers subset

    I have array of natural numbers from 1 to n. They are divided into m groups, where m*(m-1)=n. I need all m-1 elements from first group, last m-2 elements from second group, last m-3 elements from third group...zero elements from last group. For example 5*4=20: 1,2,3,4; 5,6,7,8...
  42. M

    MATLAB Spliting a line segment into desired length segments (Matlab)

    Hi Guys, I don't know if I make sense but please try to help me. I am working in Matlab. I have multiple line segments of different lengths with end point coordinates. I want to split each major segment into multiple minor segments in a way that all segments will have same length...
  43. I

    Please help my for loop goes on forever (Matlab) :/

    Homework Statement Question: A ball is launched from a height of 12m. It should land in a pool that has a length of 22m and is 9m away from the wall. Find the minimum and maximum initial velocities for the ball to land in the pool. The ramp is angled at 1 radian such that vy = 0.54v and vx =...
  44. D

    MATLAB Matlab Difference Equation Loop?

    Trying to make a three line loop that would differentiate x2√4x+1 to the nth term starting from the original function (n=0) to the 5th derivative (n=5) and then substitute 2 into the derivatives. Here's what I got f = @(x) x2√4x+1 For n=[0:5] - As the nth term goes from 0 to 5...
  45. S

    MATLAB Help needed in MATLAB , Please ( Simple question )

    hello everybody ! I'm working on a simple MATLAB program & I got stuck with something so I'll appreciate it if anyone can help how can I write an imaginary value in a MATLAB program as input , for example, impedance Z = 100+10i
  46. K

    MATLAB Matlab fprintf % usage in output data

    Matlab fprintf "%" usage in output data I want to save data into a textfile, but I will again need MATLAB to read that text file, in which case, I would like to have my header-text of the data table begin with '%" so that when I am reading from than file, MATLAB will ignore header. I am...
  47. S

    MATLAB MATLAB function that estimates pi

    I have to write a MATLAB function that estimates the value pi based on the fraction of a collection of random points in the square [1; 1] that are within the circle of radius 1 centered at the origin. I am very new to MATLAB and computer science in general and I've been having a great deal of...
  48. H

    MATLAB MATLAB fprintf(): Create Table of Height & Distances Earth & Mars

    I'm trying to create a table with three separate columns using fprintf(). The first column consists of a height vector h = 0:500:10000 and the second and third columns are part of the matrix Distance. I've tried looking online and I can't seem to find a way to make the vector and the matrix...
  49. G

    Finding power spectral density using MATLAB,

    Question: Using Matlab, generate random unary and bi-polar sequences of period Tb=1s, over-sample each sequence by a rate of 4, calculate and display their PSD. It took me way too long to generate proper unary sequences. I have yet to figure out how to code bipolar sequences. Here is the code...
  50. O

    Orbit of satellite 2nd order ODE using Matlab

    Hi, I am completely stuck on this problem that has been given to us. I must solve a set of 2nd order differential equations using Euler's method. It is for a geosychronous orbit of a satellite, meaning the orbit is circular and the velocity vector is perpendicular to the radius vector...
Back
Top