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
Upthrow simulation Conditions: initial velocity v=10m/s, initial height h=0m when t=0. Gravity acceleration g=10m/s2 .
Using Simulink to simulate the variation of height with time when t≥0.
Homework Equations
I figured that the governing equation should be:
Height =...
It's part of finite elements analysis.
All I need is to solve F=Ku,K is [12x12] matrix .
Some of the members of u are zeros ,some members of F are known forces . K is all known .
How do I solve F=Ku in that way ??
Thanks in advance.
Hello. I am completely new to MATLAB and programming in general. I never thought I would have to resort to online help, but here I am. I have spent hours googling and haven't been able to get very far.
1. Homework Statement
Calculate the distribution of the temperature of the inner part of the...
Homework Statement
Write a user-defined function that calculates grade point average (GPA) on a scale of 0 to 4 ...
https://41.media.tumblr.com/4f5e8ee38181d7c584c234138f632714/tumblr_nmnhq9p8jo1usetlso1_1280.png
The Attempt at a Solution
I'm getting the error that "function definitions are...
Hi everyone,
I will start off by saying that I am a complete novice in Matlab and prefer to use Excel however the data that I have requires more computing power than Excel can provide.
I have 16 sets of data with over 70,000 rows and 9 columns. The first column is a time series separated into...
I'm trying to model the response of a particle in an anharmonic potential in MATLAB. I know that writing position, x as a function of potential energy U is,
where T is the period, m is mass, and E is the energy of the system. How would I get a function for T(E) since it's not independent of...
In the plot below
x=.1:.01:.2;
y=5:15;
bar(x,y)
I like all the values of x to be displayed on the x-axis. For example by plotting this bar, the values of x=0.11,0.13, 0.15, 0.17, 0.19 are not displayed on the x-axis. I appreciate any help.
Hi, I am writing program to model the heat flow through different space shuttle tiles. I have got it working using four different methods: Forward differencing, Backward differencing, Crank-Nicolson, DuFort-Frankel and all four methods give me similar results. What are the advantages and...
I want to create an array of numbers between 0 and 0.1 where the points are clustered around an arbitrary point x1 (0 < x1 < 0.1). I want the points to get exponentially closer together near x1 from either side and and get further apart towards the outer limits. I am using MatLab and was trying...
Homework Statement
Homework Equations
-
The Attempt at a Solution
I've been trying several different ways but I just can't seem to figure this one out. It seems to me like I will need nested for loops, which we haven't learned yet. The way I read the question is that this program needs to...
http://postimg.org/image/6zlab4elj/
I have x and y data for the red curve and I want to fit that data to the custom equations in the red boxes. I am trying to use lsqcurvefit to do this but I'm new and I don't know how to use it.
Does anyone know any videos that would help?
Homework Statement
So I have a function that allows me to input two vectors and it will calculate the resultant vector. The code works fine.
I need to call on this function and plot the two input vectors and the resultant; it's easier to explain if you look at the code.
Homework EquationsThe...
Homework Statement
Solve from the differential equation below numerically for the function \phi(x) for x \in [0,L]
\phi '' (x) + D(x) sin(\phi (x) ) + E sin(\phi (x) ) cos( \phi (x) ) = 0
with D(x) a polynomial.
Homework Equations
Matlab.
The Attempt at a Solution
I can rewrite it in a...
hi , i am designing a data scrambler block in simulink. it is for wimax system so i have designed one using delay units, XOR gates.i used the specification specified for the initial condition of delay elements and feedback connection according to wimax forum specifications, but i am not able to...
Homework Statement
Homework Equations
Given above
The Attempt at a Solution
I used polyfit, but my mean swuare errors are way bigger than they should be- don't see what is wrong with my code! My code is ugly btw, my apologies.
%Hw 7
clear all
close all
y3=[1960;
1965;
1970;
1975;
1980...
I'm trying to solve a 2nd order differential equation in matrix form. I'm not familiar with Matlab, and have tried solving this using tutorials on youtube.
Initially, theta1 = pi/4, theta2 = 7*pi/12, theta1_d = 0, and theta2_d =0. Time interval is (0,1.2).
When I try to solve this using ode45...
How to get specific frequency and time values for .wav file and export the values as .csv?
Problem: I need to analyze this music .wav file, particularly for its frequency, amplitude, and pitch over specific intervals of time.
Is there any easy to use software and steps I can take that can...
Hi everyone!
Well, I'm a chemist and..I don't know too much about programing but i can't keep using origin for everything...it just take so much time sometimes so I want to learn Matlab and I would like to know if anyone here could recommend me a website or something to use as a starting...
Hi,
I need to plot the last function of this:
But I don't know how to generate the sum. I know the for loop is totally wrong, but I can't go any further. This is what I have:
Can someone fix the summation loop part for me?
Thanks in advance
Hi all,
I am to compute A = QR using the Modified Gram-Schmidt algorithm. I need to find the error using
the one norm of : (Q transpose * Q) - I.
Here is my code:
%Modern Gram Schmidt
p=zeros(5,5);
e=zeros(5,5);
g=zeros(5,5);
for k=1:n;
p(:,k)=(A(:,k));
end
%j=k, i=u, r=g, q=e, v=p
for...
Hi Folks,
This loop code is working fine but I would like to simplify it further. Can anyone help?
Basically, i need syntax to automate the numbers highlighted in bold.
k is a 3*3 matrix, SE_ans is a 3*1 vector, A is a 3*3 identify matrix. The rests are just constants.
for i=1:size(k,1)...
In the program below, the result of "difr" is not zero but according to the definition of qx in the second line, I expect it to be zero (because qx^2+ky^2=(\frac{ef-u}{hbarv_f})^2). What is the problem?
ef=1;hbarv_f=658;ky=0.0011;u=2.5;
qx=sqrt(((ef-u)/hbarv_f)^2-ky.^2)...
Homework Statement
I am trying to graph the flux density field between two infinite line charges located at y = 1 and y = -1
Homework Equations
I am trying to do it using the equation for a line charge that I got from lecture notes.
The above equation is derived from this:
Here is the...
The program below gives "error=4 7" unexpectedly while all the arrays of "real" are 1! I would be grateful for any help.
kky=pi/(2*10000):pi/10000:1/658;
ky=[-fliplr(kky) kky];
kx=sqrt((1/658)^2-ky.^2);
expiphi_1=(658/1)*(kx+i*ky);
real=expiphi_1.*conj(expiphi_1)
error=find(real~=1)
For Matlab, I need to write a program where a Gambler starts with 5 dollars and runs out with 1 dollar bets. The house has favorable odds of 70/30. I have gotten very far, but I can't find out how to end the loop when the gambler reaches 0. Here is my script:
A = 5
n=100;
x=rand(1,n)...
After saving several Matlab figures (with the format of Matlab Figure) how can I put all of them in one window to compare together?
And what should I do to see the file names on the figure when I saved them?
I could run the MATLAB codes but the main issue is that data for T1 and U1 could not be produced. I am currently trying to calculate the displacement of two particles after the collision with walls with length of 10 units.
Here are the codes. If you don't understand its context, you can refer...
Hello everyone
If I have a plot of a function of two variables and I want the whole curve over the whole x and y intervals but in addition I want to highlight with a black colour a specific region when the function is between two values
F between -8 and 0 or what ever
How can I do that ...
The following Matlab program
clc
clear all
for ef=1:100
ky=linspace(-ef,ef,ef*2);
for n=1:3
r(n,:)=2*ky;
end
end
encounters this error:
? Subscripted assignment dimension mismatch.
Error in ==> testarrays at 6
r(n,:)=2*ky;
But if I use ky=linspace(-ef,ef); there is no error! why...
The blobdetector consist of the following functions:
gaussImage: Filters a image with a gaussian filter
gaussPyramid: Uses gaussImage to filter the same image several times with different std.
diffOfGaussians: Uses gaussPyramid to compute the difference between consecutive filtered images...
Homework Statement
Homework EquationsThe Attempt at a Solution
Okay, so first off I'm just trying to write the code for scalars:
--------------------------------------
clc ; clear
P = 2000
r = .035/12
n = 36
F = (1 + r).^n
A = (r*P*F)/(F-1)
---------------------------------------
This...
I am trying to write a script that will compute repeatedly, beginning with step size h=1 and then progressively divide the step size by a factor of 10 to demonstrate how round-off error becomes dominant as the step size is reduced.
In using centered difference approximation of O(h2) to estimate...
I have been working on writing g a script file that will:
Calculate f(x)=5sin(3x) using the Taylor series with the number of terms n=2, 5, 50, without using the built-in sum function.
Plot the three approximations along with the exact function for x=[-2π 2π].
Plot the relative true error...
Hi. I have written some functions in Matlab and I would like to use them, the problem is that they require a lot of computations and hence takes a lot of time to calculate everything. I suspect that my computer may be slower than it should. How can I check the performance of my computer speed in...
Homework Statement
Hello, i have a MATLAB code that simply lists a bunch of parameters with values and an equation that relates all of them together. I am getting on error that says
Error in ==> randelltest at 17
Ys0=Yl*{(Pm-Pc)*Yc/Yl*(1-Av*Tm/2*Yc/Yl)-Av*Tm*Pm/2}*(1-1/B);
Is there a problem...
In the Matlab program below
U=[210; 100; 150]
ky= linspace(-.2,.2);
qx=sqrt(((150-U)/.2)^2-ky.^2)
I want to have qx as a matrix in which each row is corresponding to one value of U: the first row corresponds to 210, the second to 100 and ... How should I do this? (I want to avoid the "for...
Homework Statement
Given variable b that contains a row vector of length 10, assign the contents of the odd indeces in b to variable odd , and assign the contents of the even indeces of b to variable even.
Examples:
Input b = [8 -3 0 7 -6 -3 1 8 7 -2]
Output odd = [8 0 -6 1 7]
even =[-3 7 -3...
I have big problem with finite difference schemes (DS) on Matlab. I need write DS on Matlab, example:
u_x=(u_(i+1,j)-u_(i-1,j))/2, we choose step is 1.
On Matlab:
u_x=(u( :,[2:n,n])-u( :,[1,1:n-1]))/2
And I can write u_y, u_xx, u_yy, u_xy. But now, I need to write for higher order, example...
Homework Statement
Use Matlab to construct a signal of length 2^13 = 8192 that contains only three frequencies:
x=0.5*sin(2*pi*200*t)+0.2*sin(2*pi*455*t)-0.3*sin(2*pi*672*t)
Compute and plot the absolute value of the DFT.
What does the question mean by signal length and why is it expressed...
Homework Statement
Not really for homework, but it is a script I am working on. It involves utilizing the Bisection Method for solving equations in one variable. However, I cannot seem to get it to work properly. It seems to enter the while loop and become stuck their. When I execute it by...
Hi,
I wrote a simulation of lock in amplifier using Matlab and now i want to test it for different SNR.
I added to the signal white gaussian noise. In all the spec that i read, always written that the lock in amplifier can handle -100dB of noise.
When I add a noise of SNR=-30dB the lock in...
Hi guys I'm new to MATLAB but now i need to use it for my study. I've tried to learn by myself to run it but unfortunately it failed, so I need some guidance on how to run following time step function in MATLAB
St = St-1 + Pt - ETt, St-1 + Pt - ETt ≤ Smax
= Smax, St-1 + Pt - ETt > Smax
then...
Can someone please help me in plotting a D'Alembert wave equation solution in MATLAB? I am so confused as how to plot it in MATLAB
I need to plot a graph like the one below
Hi guys:
I have a program which is supposed to fit x- and y-data to a certain function and give me the optimum parameters. This is no problem. What I want to do though is to perform a for loop that allows me to plot the CHANGE in those parameters over time (as I conduct a real life...
I am looking for a concise textbook or anything else for Matlab programming, very useful and not necessarily introductory, appropriate to the needs of physics students especially solid state physics. Thanks in advance for any help that anyone can provide.
Hi everyone,
I am a High School student (final year) and am doing an extra-curricular project. Having complete autonomy on what we do the project on, I choose to design a High-Altitude Long-Endurance (HALE) UAV, such as the QinetiQ Zephyr [http://www.airforce-technology.com/projects/zephyr/] or...
Im a mechanical engineering student currently, with a third year project of simulating ultrasound propagation through the abdomen. Currently i just want to simulate it going through muscle with no obstacles. I don't really understand where to start, I have formed some equations based on the wave...