Matlab Definition and 1000 Threads

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. E

    Difference rand and randn command matlab

    i am confused between when to use rand and randn . can someone explain to me please?
  2. E

    Why Is My MATLAB Simulation of Orbiting Masses Not Running?

    Homework Statement I have created random mass and try to make them go around each other . somehow i couldn't find where all the code goes wrong. how do i fix this The Attempt at a Solution I have coded this. but still the file can't be run. i don't know where to fix this . %...
  3. Superposed_Cat

    MATLAB Solving MATLAB Duplication Error with For Loop

    Hi, I'm totally new to MATLAB and tried this for loop for K = 1:10 disp(abs(tan(K))) end it displays 1.5574 2.1850 0.14255 1.1578 3.3805 0.29101 0.87145 6.7997 0.45232 0.64836 1.5574 2.1850 0.14255 1.1578 3.3805 0.29101 0.87145 6.7997 0.45232 0.64836 Why did it display...
  4. Q

    MATLAB [Matlab] Numerical Code for the NLS equation

    hello i just copied the Numerical Code for the NLS equation which is the following: %---specify input parameters clear all; distance=input('enter fiber length(in units of L_D)='); beta2=input(' dispersion: 1 for normal, -1 for anomalous'); N=input('Nonlinear parameter N=')...
  5. E

    Rotate Point in Matlab Plotting

    Homework Statement i need to fix a point and rotate another one Homework Equations The Attempt at a Solution i did this i've created this: x=rand(1,3) y=rand(1,3) scatter(x,y) how do i select and make one point fix and make the other point rotate around it?
  6. E

    How can I create and manipulate multiple points in MATLAB?

    Homework Statement i had some problem with MATLAB of how to create two points of random positions and adding another few random pointsHomework Equations how to create the points, set a point as the centre, make the iteration for one point to rotate the centre and also the other iterations for...
  7. E

    Using finite difference method for solving an elliptic PDE with MATLAB

    Homework Statement Given that we the following elliptic problem on a rectangular region: \nabla^2 T=0, \ (x,y)\in \Omega T(0,y)=300, \ T(4,y)=600, \ 0 \leq y \leq 2 \frac{\partial T}{\partial y}(x,0)=0, \frac{\partial T}{\partial y}(x,2) = 0, \ 0\leq x \leq 4 We want to solve this problem...
  8. V

    MATLAB Maximizing the fraction of two integrals using matlab

    EDIT: I left out something of major importance, I want to maximize with respect to a! Good day, I've run into an issue in solving a certain problem with matlab, and I was hoping if anyone could help me out. I am relatively new to matlab, so I don't even know if this is possible, but I...
  9. P

    MATLAB question re interpolation and approximating derivative.

    Hi, I'd sincerely appreciate it if someone were willing to review the few lines of MATLAB code below and indicate why they don't quite yield the expected output. Homework Statement I am asked to generate using MATLAB approximated values of f(x)=cos(x) at nodes x+h,x-h with random errors...
  10. M

    MATLAB MATLAB Script Help - Plotting 2 Functions to Find Intersection

    Attahced is my short MATLAB script, I am basically trying to use iteration to plot 2 sets of 2 functions to see where they intersect, all other information in the script are constants. attached also is the incorrect graph that i get flux = F If = Ifield Any help would be appreciated
  11. M

    MATLAB Need some guidance - Graphing in Matlab

    Need some guidance -- Graphing in Matlab Hello, I am doing a project using Matlab. I need to generate this graph as shown in the attachment. For the gas and liquid superficial velocity, I am able to find the equation but as for the Flow pattern transition boundary equation(the darker lines), I...
  12. M

    MATLAB Irritated by Matlab should I retake the course?

    Hey fellas how are you all doing? This is my first year as an engineering student and so far I am enjoying most of my classes(Math, chem, programming) except for one, my MATLAB class. This class is really a pain in my ***. This is my first time seeing a programming language and I have a grade...
  13. S

    MATLAB How to Resolve a Plotting Error in Matlab?

    HI, i have a set of data that i want to plot with matlab, using an equation. i have all x data points and want to generate y values for each x data point. function y =marko(x) y= (4.11/1.98)*{(1/4*((1-x/L).^2))-(1/4)-(x/L)}; x=(218+data points) from the command window i have...
  14. A

    MATLAB Critical points of system of ODE in MATLAB - Game theory and poker

    Hello there, I hope I'm posting in the right section. I have been doing some work on evolutionary game theory and poker. I will give a brief description of how I got here. I have eight strategies i = 1, 2, \ldots, 8 and the eight proportions of the population playing each strategy is...
  15. S

    Solving Matlab Newton's Method Homework

    Homework Statement So, I've written a program that carries out Newton's method. The root of the equation which I am trying to find is approximately 13.1. This is fine and my program returns the correct value when my initial guess is around this value (up to about x = 50 as my initial guess)...
  16. S

    MATLAB [Matlab] Subscripted assignment dimension mismatch.

    Hi all, I have the following program, but with this error [Subscripted assignment dimension mismatch. Error in test_vlf_spherical (line 62) ep(i,j)=ga(i,j)*ep(i,j)+gb(i,j)*((1./r(i)./dr)*(rph*hr(i,j)-rmh*hr(i-1,j))...] i am trying to solve the problem by using (./) but i...
  17. E

    MATLAB How can I calculate THD using MATLAB?

    Hello, I'm a novice in using MATLAB. I want to calculate THD value from my experimental data using MATLAB. I have 10,001 data points, sampling frequency is 100kHz and fundamental frequency is 50 Hz (I'm not in USA). Below is my code. Could you please check that my code is correct or not ...
  18. P

    MATLAB MATLAB - Calculate distance/perimeter of an object in 2D image

    Hi, I want to find out how thick/big/fat is the object in the image. For example, there is a tree in the image(photograph), I want to use MATLAB to calculate how big the tree trunk is. Problem: Find out the perimeter of trunk as shown in the first picture (named "perimeter.PNG". attached...
  19. O

    MATLAB Mastering Matlab for Bode Plots: Understanding Transfer Functions Easily

    Hello I need to do bode plot.. but i not to sure how to use matlab.. i need this 1 / (a + bs)s num = 1 how to key in the den to get (a + bs)s.. i try different way and i can't get 1/(a+bs)s hope to get help
  20. P

    MATLAB - forming an array of sums?

    Hi, Homework Statement I am asked to evaluate the following sum S=Sigma(n=0 to N) x^n/n! (namely, e^x as n->Inf) for N=10:10:100 and x=10, so that every element S(i) is a partial sum which approximates function e^x with different accuracy. Below is my code, which doesn't work. Homework...
  21. T

    Matlab help. invalid target for assignment trying to solve

    Homework Statement hey there, i'm trying to solve for beta which I tought i'd easily be able to figure out using MATLAB (i'm not the most proficient MATLAB user) but i can't get it to work.. Homework Equations The Attempt at a Solution My code is as follows: clear all...
  22. twoski

    MATLAB Mastering Newton's Method and Graphing in Matlab: A Step-by-Step Tutorial

    Hey guys, I have to make some graphs for an assignment and a friend told me it would be easiest with matlab. I need to make an x(k+1) vs. x(k) graph for Newton's method as well as the Chord method. I also need to make a few charts of the discrete logistic equation. Plotting functions isn't...
  23. I

    Why isn't MATLAB producing graphs for my program?

    Homework Statement Hello there. I ran a MATLAB program and i can't produce any graph. Please help me Homework Equations This are the program L = 1.; T = 1.; maxk = 2500; dt = T/maxk; n=50; dx = L/n; cond = 1/4; b = 2.*cond*dt/(dx*dx); for i= 1:n+1 x(i) = (i-1)*dx; U(i,1) =...
  24. S

    User Defined Functions in MATLAB

    Homework Statement Write a user-defined function that calculates grade point average (GPA) on a scale of 0 to 4, where A = 4, B = 3, C = 3, D = 1, and E = 0. For the function name and arguments use av = GPA(g,h). The input argument g is a vector whose elements are letter grades A, B, C, D...
  25. L

    MATLAB Programming Loops Question

    Homework Statement Write a program that does the following: Prints the four gases on the screen and asks the user to select which gas to find the heat capacity for. Asks the user for a temperature. Asks the user if another temperature is needed (enter yes or no). If the answer is yes...
  26. M

    MATLAB Polymath or Matlab non-linear algebraic solver

    Hello, I am having difficulty inputting a non linear algebraic equation into polymath to solve for reference the equation is x*(100-.5*x)^0.5/(15-x)/(20-.5 * x)^0.5 - 87.824 == 0 and I want to solve for x, but haven't gotten anything. Also I don't know how to program it into matlab...
  27. M

    MATLAB Matlab transfer function problem

    I have a transfer function L(s) = A(s)/B(s) that I call Ls. However, when defining H(s)= L(s)/(1+L(s)) by %% Ls = -70.6s^2 - 2003 s + 3375 -------------------------- s^3 + 119.6 s^2 + 2806 s %% Hs = Ls / (1+Ls) things go wild. The highest...
  28. S

    [MATLAB] complex permittivity for earth ionosphere syntax

    Homework Statement I have these equations: ga = exp(-σ^{R}Δt/ε_{0}*ε^{R}_{r}) Homework Equations σ^{R}=(ε_{0}*ω^{2}_{p}*v)/(ω^{2}+v^{2}) The Attempt at a Solution %ionospheric profile for earth-ionosphere waveguide as coefficients e = 1.602e-19; % electron charge...
  29. M

    MATLAB Plot the equation y=cos(A*x) + i*sin(A*x) in MATLAB

    Hi Everyone, I am a new Matlab User, I am want to plot the equation y=cos(A*x) + i*sin(A*x) where A = 400*pi/340 and want to plot y and vary x from pi:0.1:pi clear all; close all; A = 400*pi/340; x = -180:0,1:180; a=cos(A*x); b=i*sin(A*x); i= imag(b); hold on; grid...
  30. S

    MATLAB Probability at Party function.

    Homework Statement So, you're asked to write a function that computes the probability of two people at a party having the same birthday. The probability function itself is P(n) = 0, n = 1 P(n) = 1 - (capital pi from k = 1 to k = n - 1)(1 - k/365), 2 <=n <= 365 P(n) = 1, n >= 366 The...
  31. R

    MATLAB Skin effect derivation and plotting in Matlab

    This is driving me crazy. The derivation of the current distribution in a long cylindrical wire is extremely straightforward, giving J(r) = J(a) \frac{J_0(k r)}{J_0(k a)} where J is the current density, a is the radius of the wire, and k is the complex wave vector, which in a metal (with...
  32. N

    MATLAB Plotting cosine in matlab looks really funky

    I have to plot a bunch of cosine waves and then add them up but my problem is that each indiviudal wave looks really weird when I plot and not like a cos wave. The program runs and plots the final result but I'm not sure how accurate it is because when I plot each individual cos wave I know it...
  33. P

    MATLAB Create B-Spline curve using MATLAB

    I need a MATLAB expert to guide me on how to create a b-spline curve using MATLAB Software. I understand the B-spline basis function calculations for zeroth and first degree but I have no idea on how to calculate for the 2nd degree. I need a favor on that part. I am currently working on my...
  34. S

    Using Tic Toc in MATLAB for Calculating Sum with Loops and Vectorised Commands

    Homework Statement Calculate the time taken to compute sum of 1/k^3 from 1 -> 1000 using both loops and vectorised commands using tic toc. Homework Equations The Attempt at a Solution tic n = 1e3; % number of terms in the sum s = 1...
  35. S

    MATLAB Matlab - matrix with blank space

    r=zeros(1,6); r(1,2:4)=2; r(1,5)= - rfor the above program, I want the output as r= 0 2 2 2 - 0 how to do this in matlab? please help
  36. P

    MATLAB Solving an Argument in MATLAB with Linprog

    Dear All Firstly, thank you for looking at my post. I am so close to a solution to a problem that has been given me a massive headache. I am also very stupid and was wondring if one of smart guys could take a look at my problem and see if you might be able to help. I am trying to...
  37. S

    MATLAB Can You Nest If Statements in MATLAB?

    Just started a new college module and we'll be using MATLAB quite a bit. I was wondering, can you nest if statements in MATLAB like in C#? Would code such as this work in MATLAB? if (condition 1) if (sub condition 1) Code elseif (sub condition 2) Code elseif (condition...
  38. B

    MATLAB Need help plotting Fourier series in matlab

    Hi all my first post as I need to seek help! I have just learned some simple Fourier series stuff and would like to be able to plot my answers in matlab. Assuming this is correct I was wondering if someone would be able to walk me through plotting this equation in Matlab...
  39. T

    How can I improve my GE program using MATLAB?

    Homework Statement I am writing a GE program and i think i have that correct. I have a matrix and i am trying to find the correct answer. I am not sure where i am going wrong. Homework Equations The Attempt at a Solution %GE with no pivoting function x=ge_nopivot(A,b)...
  40. T

    Matlab help. Using Newton Raphson

    Homework Statement Two forces P and Q are applied at the end of a screw eye in order to remove the post. Homework Equations The two equations that were found are 1.) Q*sin(30)-P*sin(θ)=0 2.) Q*cos(30)+P*cos(θ)-800=0 The Attempt at a Solution I combined the 2 equations by first...
  41. B

    MATLAB Doing a phase-space portrait in matlab

    So I have this system of equations: \binom{x_{n+1}}{y_{n+1}}=\begin{pmatrix}e^{r} & 0 \\ 0 & e^{-r} \end{pmatrix}\begin{pmatrix}cos(\phi+I_{n}) & -sin(\phi+I_{n}) \\ sin(\phi+I_{n}) & cos(\phi+I_{n}) \end{pmatrix}\begin{pmatrix}x_{n}\\ y_{n} \end{pmatrix} where I_{n}=x_{n}^2+y_{n}^2...
  42. T

    Writing Matlab program for Newton Raphson

    Homework Statement Two forces P and Q are applied at the end of a screw eye in order to remove the post. 1.)variations (plots) of P and Q versus (theta) for a given value. R=800 N 2.) for what value of theta we obtain P=Q? Homework Equations...
  43. A

    MATLAB Excel date column export into Matlab

    Hi everybody, I need assistance. I have excel file that conntains a date column and another column. I wish to plot the date on x-axis and the second column on y axis. I wrote the MATLAB code below. This is my code. data=xlsread('DataTest','Sheet1'); q=data(:,2); time=data(:,1); Error...
  44. P

    MATLAB Histogram coloured by different hues in matlab

    Dear Physics fans, Are we all okay? I hope so. I was wondering if you could help me please? I am banging my head against a wall in MATLAB and I think what I need to do should be very easy. I have a histogram of intensities and I could like to colour then starting off at black and...
  45. N

    MATLAB Understanding Positive Feedback in MATLAB

    Hi All, Suppose I have the following system: A = 1 / (S + 1) (open loop) B = S / (2S + 1) (feedback path) I know that the positive feedback closed loop system will thus be: A / (1 - AB), and entering this manually in MATLAB (as well as doing it by hand), I get: 2 s^2 + 3 s...
  46. S

    MATLAB Solving MatLab Misunderstanding: Element-by-Element and Point-wise

    I'm current learning MatLab before i start my second year of engineering and i don't really understand a fundamental aspect of it. My problem is the use of the period "." and when it is deemed to be necessary. I've looked up what this operator does and found definitions such as Element by...
  47. M

    Finding the sum of multiples of 3 and 5 below 1000 (Matlab)

    Homework Statement Project Euler Problem 1. If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23. Find the sum of all the multiples of 3 or 5 below 1000. Hello, there I do understand what a multiple is, and...
  48. H

    MATLAB Cavity simulation on matlab with spatially dependent phase

    Hello there, I have been searching for MATLAB simulations that analyze optical cavities and there are some useful codes. Yet, I haven't found codes that analyze what happens to cavit transverse modes if spatially dependent phase is introduced between mirrors Does anybody know if there...
  49. dexterdev

    MATLAB How to find covariance matrix of 3 or more vectors in matlab?

    Hi all, I know how to find covariance of 2 vectors and variance too. If covariance matrix is to be found of 3 vectors x,y and z, then then the cov matrix is given by cov_matrix(x,y,z) =[var(x) cov(x,y) cov(x,z); cov(x,y) var(y) cov(y,z); cov(x,z) cov(y,z) var(z) ]; Is this...
  50. M

    MATLAB Matlab - area values into raster data

    I'm trying to transform area values into raster data. I have areas, defined as circles (location of center + length of radius). Each area has a designated value between 0 and 2. I used Matlab's command area to plot the areas and also to designate the value that goes with each area. Now I want...
Back
Top