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.
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 .
%...
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...
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=')...
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?
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...
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...
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...
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...
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
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...
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...
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...
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...
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)...
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...
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 ...
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...
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
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...
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...
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...
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) =...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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)...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...
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...