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 want to make MATLAB coding which is similar to this program.
--> http://www.filmetrics.com/reflectance-calculator
if i put n layers which is consists of each different n(refractive index), l(length),
then it will calculate M=M1*M2+M3...*Mn, and calculate R. and plot R with...
Prepare a function m-file containing a function that converts polar coordinates in two-dimensional space to rectangular (Cartesian) coordinates. Include a suitable H1 line and some additional comment lines. The input will be 2 vectors, and the output will be 2 vectors. The length of each vector...
Homework Statement
I am trying to run code for the code below but MATLAB runs out of data.
The Attempt at a Solution
NumberOfVariables = 9;
k=NumberOfVariables^2-NumberOfVariables+1;
integers = 0:k-1;
numbers = 1:k-1;
tic
s = combnk(integers,NumberOfVariables);
AllAnswers = [];
for i =...
Whenever I try to reduce, invert, or factorize matrices of size 10000x10000 my whole system suddenly restarts without any error message. This happens on both julia and MATLAB when I run the command A=rand(10000,10000)^-1;
I suspect the problem is due to the linear algebra libraries (I have...
I have these two images:
And I have this impulse response function, or the point-spread function (PSF):
The first image is the actual size of the PSF, and the second image has zero pads included.
I tried deconvolving the images this way (with MatLab):
deconvolved_image =...
Hello! (Wave)
I have written the following code in matlab:
function v=uexact(x,t)
v=sin(2*pi*x)*exp(-4*pi^2*t);
end
function [ex]=test3
h = 1/50;
T=1/2500;
x=0:h:1;
t=0:T:1;
ex=uexact(x,t);
end
I...
I have a list of latitudes:
lats =
41.0100000000000
43.7800000000000
44.4200000000000
41.2500000000000
42.8000000000000
42.7500000000000
42.4900000000000
42.4900000000000
42.7800000000000...
Is it possible to enlarge a 3D patch without altering the size of the colorbar? My original picture is like this one:
https://www.dropbox.com/s/xashny3w1fwcb2f/small.jpg?dl=0
I just want to enlarge the block in the middle of the figure keeping the colorbar unchanged. I used zoom(1.9) before...
I would like to plot a number of 3D graphs from different data files. For example I am using
fid = fopen('SS 1.dat','r');
to read the first file and then plot a graph. How to set the program to change the name to 'SS 2.dat' automatically? Also for the tenth file the name becomes 'SS 10.dat'...
I am trying to test the function movie2avi using simple codes in R2014a as follows:
clear; close all;
figure;
Z = peaks;
surf(Z);
axis tight manual;
ax = gca;
ax.NextPlot = 'replaceChildren';
loops = 40;
F(loops) = struct('cdata',[],'colormap',[]);
for j = 1:loops
X =...
Hello everyone I am going to buy a computer soon. And because I don't have much money, computer s ram can be 4 GB at most and which will cause me some trouble. My question is that will 2gb ram be enough to work on MATLAB and learning to code.
I have a Dicom Image that is interpreted as an array. Each cell is a pixel. Each pixel has a value. I want to find the vector components (x,y,z) of a pixel. Specifically, I want to find magnetic field vectors for each pixel. The image is for H1 atoms. Freq = 297, B0 = 3.
How would you do this...
Homework Statement
All the necessary data is in the code, I'm just trying to converge NR, I decided to use the equation S = V^2 / Z since I had the admittance matrix and powers (needed voltages)
I think my simple algorithm has a slight issue I can't find.
Homework Equations
Thank you!
The...
I had to use a network analyzer measuring the standing wave pattern along a transmission line taking data points at half mm increments. The software I used got me the values in a text file and the way it is formatted, I can't figure out how to make the left side the X axis and right side the Y...
Hello,
How can I calculate a triple correlation between 3 signals A,B,C (each has 2 million samples)? I know xcorr do it for 2 signals by FFT each signal, multiplication and iFFT back. Since xcorr cannot do it for three signals, I try to do it "manually" by the above algorithm.
So, the "regular"...
I have done a search online to understand how to convert ECI to ECEF. I wanted to learn what the conversion is so I could just create a MATLAB script to make it happen. My problem is that most of the information I find assumes you already have some knowledge about ECI and ECEF. If I had more...
I want to create figure that is enlarged, I use:
fig = figure(1);%These two lines maximize the figure dialogue
set(fig,'Units','normalized','Position',[0,0,1,1]);
Then I use zoom(1.9); to enlarge the figure
The dialogue is enlarged. But I want to reposition it just like use the "pan" button...
I am trying to plot the magnitude of velocity and position against time but keep running into issues.
The error I am getting here is:
Subscript indices must either be real positive integers or logicals.
Error in project2 (line 46)
position(t) = w(1:3);Here is the relevant portion of my...
I want to have three plot 1,2,3 in Matlab with the symbols (a), (b) and (c) on plots 1, 2 and 3 respectively.I can do it by text('(a)'), text('(b)'), text('(c)') on the plot 1,2 and 3 respectively but I want to have the three symbols on the same position on the three plots for example...
Homework Statement
I have a few data-analysis problems due to Thursday,
1. Assume that a sandbag is dropped at different heights and the observations are (z
i;ti) pairs. Physical model for a free fall is z=½gt2. Assume that the height measurement z has an additive random error v. The...
Homework Statement
Given: Initial orbital elements of a satellite
a=6652.555663km;
e=0.075;
i=28.5 degrees;
Ω=40 degrees;
w=30 degrees;
n=0 degrees;Tasks(using MATLAB):
1. Convert orbital elements to position and velocity vectors
2. Use these vectors to initialize the Runge-Kutta...
Hi guys! I am trying to fit a function whose x data depends nonlinearly on the parameter of the fit and I am having hard time doing that!
I will explain better: from my experiment I was able to measure my ydata e my x0 array and I know that my xdata are:
x=x0+a/(1+4x^2), with a being a...
hey hey :)
So this is the code i came up with
%% part 2
x=[1 2 3 4 5];
% 1 is freshman
% 2 is softmore
% 3 is junior
% 4 is senior
% >4 is super senior
for i=1:5
s=input('number: ');
switch s
case 1
yearNumber='freshman';
case 2...
Hi,
I am wondering how to plot a complex function of the form:
Ψ(t) = Ansin(n⋅pi⋅x/L)e-iEnt/h + Bnsin(m⋅pi⋅x/L)e-iEmt/h + ... +
where m and n are known eigenvalues of the infinite square well with corresponding energy En, for any particular x? So, this will be a function of solely t.
Any help...
Homework Statement
So I've done an experiment by scanning over a range of angle and measuring the intensity of X-Rays. There are peaks where I have X-Ray diffraction occurring and in order to do analysis I need to identify the values of angle and an error (as in the plus/minus) on this value...
I am trying to write a function called ispalindrome, with Matlab, It is supposed to check if a word is a palindrom or not.
It will then return a value True (1)or False(0) for each word.
I have tried to run this, but something seems to be wrong...
function isPalindrome (word)
word =...
Homework Statement
I am supposed to find the roots of the equation: 10esinx = x2 - 5x +4 in MATLAB using Newton's method with a tolerance of 10-8. There should be three roots.
Homework Equations
p=po - f(po)/f'(po)
|p - po| < TOL
The Attempt at a Solution
Here is what I have for the code...
Hi,
I have been wanting to do this for a while but not too sure how to go about it. I have the following geometric algebra
\lbrace\mathbf{e}_{i}\rbrace_{i=0}^{3} which satisfy the following relations: \mathbf{e}_{i}\mathbf{e}_{j}=-\mathbf{e}_{j}\mathbf{e}_{i} and...
Considering two functions of ##t##, ##f\left(t\right) = e^{3t}## and ##g\left(t\right) = e^{7t}##, which are to be convolved analytically will result to ##f\left(t\right) \ast g\left(t\right) = \frac{1}{4}\left(e^{7t} - e^{3t}\right)##.
According to a Convolution Theorem, the convolution of two...
Homework Statement
How can I make a calendar with fprintf? It is making me crazy. The parameters year and month are supposed to give me the whole calendar, with month day and dates.[/B]Homework EquationsThe Attempt at a Solution
I just get the first line of the month[/B]
Homework Statement
Plot the direction field of y' = −t(y 2 − .5y − .5) for t=[0,5] and y=[-2,2]. Plot a line every 0.25 units in t and y. The length of each line should be 0.1. Hint: Use line(). Look at the picture to determine the starting and ending coordinates of each line.
Homework...
Homework Statement
Okay the problem is of a free swinging pendulum with dampening which is modeled using the following equation:
Damping coefficient: c=1 s−1
Mass: m=1 kg
Gravity: g=9.81 ms−1
Link length: l=0.5 m
We know
θ(0)=90° and θ′(0)=0, solve this equation from t = 0 to t = 10...
Homework Statement
Use MATLAB to find the convolution between
a) ##f(t) = u(t) -u(t -3)## and ##g(t) = u(t) -u(t -1)##
Homework Equations
The Attempt at a Solution
t = -10: 0.1: 10;
f = heavisde(t) -heaviside(t -3);
g = heaviside(t) -heaviside(t -1);
t = -20: 0.1: 20;
c = conv(f, g);
plot(t...
Create a matrix with 4 rows and 8 columns with every element equal to 0. Create a second, smaller matrix with 2 rows and 4 columns where each row is [1 2 3 4]. Replace the 0s in the upper left-hand corner of the bigger matrix with the values from the smaller matrix. (If you do this correctly...
We want to know the square and the cube of each of the following numbers: 1, 2 and 3. You can have MATLAB obtain these results as follows.
Create a vector [1 2 3] . Create a vector [2 3]. Use these two vectors as inputs to the meshgrid function (with the 3-element vector as the first argument)...
I have an assignment for MATLAB where I am required to create two vectors x and y and then to find the sum in three ways.
first, create an extra variable z and find the sum
second, use the dot function
third, multiply x with the transpose of y
here's my code
x=linspace(0,1,5)...
I am doing an experiment that generates data in three 1-hour-blocks. Each block has a different number and timing for acquisitions. (The first hour is more frequent and numerous, while the last hour is only 6 acquisitions)
The reason for breaking it up into 3 hours is to give the subjects a...
Hello,
I have a state space equation at hand.. This attached with this...
Now the term (theta double dot) is a positive step for 0,136 milli seconds and negative step for next 0,136 millisecond and 0 at all other times.
So that when I simulate I will get a graph as below:
This is the nature...
Hi, I have to solve one equation on Matlab. The equation is: (p-c)*psi'-psi=0 I have to find p. Where psi is:
and psi' is the derivative of psi. I've written this code:
rho = 0.04; %In the image is lambda
c = 25;
eta = 0.02;
mu = 40;
sigma = 0.57;
alpha = -rho/eta;
syms p t
F =...
Dear Group,
I am trying to run Matlab Compiling Running (MCR) using Python, DOS, Putty ...like matlab.exe
Anyone who worked with it before, please give me some recommendation,
Thank you very much Group.
Nate Duong.
Hello,
I am trying to publish a file on matlab, and for some reason it won't accept my code, even though it works on this forum. Does MATLAB use some other syntax for matrices?
$$ \vec {x} = \begin {bmatrix} T-T_{s} \\ C_{A} - C_{As} \\ C_{P} - C_{Ps} \end {bmatrix}$$
Homework Statement
The number of iterations it takes for the product of two random numbers to produce a number less than 1e-5.
Homework EquationsThe Attempt at a Solutionwhile z < 1e-05
count1 = count + 1;
x = rand(1,1); %rand 1x1 matrix
z = floor(a + (b-a+1) * rand(b,1));
if z <...
Hi pf
I have a question that I have not been able to find. The below function accepts outside scalar inputs but not vectors. The code is below.
Also, ## a, b, delta,FA,Hi,vHnew,iv## are all scalars defined outside the function. The vector I would like to add as an input is ##x##, which I've...
Hi, I have a problem with my MATLAB code. The error is: "Function 'diff' is not supported for class 'function_handle'."
I have installed the toolbox Symbolic Math Toolbox after the installation of Matlab, but I think that it works, so my code is this:
t=2;
alpha=2;
p_0=20;
c=10;
eta=0.2...
Homework Statement
Okay basically we have two vectors x and y, and we are required to use the signum function to get the negative and positive ones and preform a operation on them. That is square the positive ones and square root of the absolute value of the negative ones.
x= [ 1:1:10]
y= [...
I'm an 2nd year student aiming for the major "Geophysics", my course, "Numerical Programming for Geophysicists" is teaching me how to use Octave, not Matlab, and they force me to use the terminal, not the GUI, on top of that we use Linux, i am also learning Shell and Python.
Regarding the...
I'm wondering if anyone has found a (preferably free/open source) text editor for Android that highlights matlab/octave code syntax? I recently got a tablet and thought it would be pretty nice to be able to use it to quickly put together some calculations/plots during discussions and so. I've...