Hello everyone. I want to calculate the covariance matrix of a stochastic process using Matlab as
cov(listOfUVValues)
being the dimensions of listOfUVValues 211302*50. I get the following error:
Requested 211302x211302 (332.7GB) array exceeds maximum array size preference. Creation of...
Matlab help!
Hello
I want to create a sentence 2
sen1: I love flower
str1: love
str2: hate
How can I create sen2= "I hate flower" using findstr and array concatenation?
I am trying to simulate and process the Doppler signals. My main problem is a little more complex so I am only posting a simple version of it. Task1: I have a time-domain signal with the velocity of the target as mu. I need to change the velocity to mu cos(theta) where theta is a vector from 0...
Hello everyone. I am trying to implement the mcKL expansion proposed in this article using Matlab and two vectors of correlated data of size 1000*50, meaning 50 realizations of two random processes measured 1000 times. As the article says, if two stochastic processes are correlated, one cannot...
I have copied the code of the accepted answer to this post in the official Matlab forums, since I am interested in performing the KL expansion myself.
clc
clear all
y=[1,2,4;2,3,10];
y=y' %Reasons for transposing will become clear when you will read the second point given below...
function Asteroid_Mining
clc
%Initial conditions
g0 = 9.81; %gravity (m/s^2)
p = 1.225; %atmospheric density at sea level (kg/m3)
Re = 6378; %radius of Earth (km)
Ra = 7.431e7; %distance of Bennu from Earth in (km) [August 2023]
G = 6.674e-11/1e9; % Gravitational constant (km3/kg.s2)
mu =...
Using MATLAB, I am trying to calculate the time taken for a spacecraft to travel from Earth to a near Earth asteroid and then returning back to Earth but so far I have had no luck. Furthermore, I want to plot a Hohmann transfer and calculate the mass of fuel required for this mission. If...
The assignment is to find the optimal operating temperature and maximum product concentration of reactant B, assuming a constant temperature across the PFR length. Please could someone help? thanks
the reaction is a series reaction: A → B → C (liquid phase)
Here is my current code which is...
The problem I am having is simple. I have a Gaussian spectrum initially. Like this,
Process 1:
S = m0/sqrt(2*pi*sigma^2) * exp(-(vel_axis - mu).^2/(2*sigma^2));
Here, mu is the mean velocity (frequency) and sigma is the standard deviation. vel_axis is the axis on which I am calculating this...
Hi. can you help me to plot orbit around Earth with sphere in MATLAB?
I wrote the code that plot 3D orbit but without earth.
the code:
clear all
close all
clc
R=6371e+3;
r0=3e+5;
p0=[R+r0;0;0;0;10000;0];
[t,p]=ode45(@sattelite,[0,12000],p0);
xout=p(:,1);
yout=p(:,2);
zout=p(:,3);
vx=p(:,4)...
hi guys, I'm trying to write a program in MATLAB to solve and plot equation of motion of 2 body problem but it errors as i don't know what it says!
do you know how to help me? please!
The main equation is r(double dot)=-(mu)*r(hat)/r^3
The code that i wrote is:
clear all
close all
clc...
Hi, 2 part question trying to get tetrahedron Finite Element shape functions working: 1) How do I properly setup the shape coefficient matrix and 2) How do I build the coefficient quantities in the shape functions properly? ANY tips or corrections may unblock me and would be of much value...
I tried to write to the code, but I got confused in line 46 & 59.Every new added bus increases the dimension of the Z matrix, and since we have 3 busses, the dimension of Z should be [3x3]. I formed a for loop in case of adding a new bus to add a new row and new column (increases the...
Hi! I really need help with the following Matlab problem.
What does this code do? I need to comment what the important lines of this code do. Also the code contains several errors which i need to find. Here is the program:
clear all; close all; clc;
Maxi=50; tab=[1 :Maxi] ; tab(1)=0;
while...
Here's my work:
clc;
clear all;
% Ybus by step by step method for an any bus system
% | From | To | R | X | gsh | B | T|ysh
% | Bus | Bus | pu | pu | pu | pu | ph-sh
linedata = [1 2 0 -5 0...
I want to solve transportation problems (TP) in MATLAB. For solving LPPs, MATLAB provides the linprog function in the Optimization Toolbox.
According to my book, the following is a TP:
##\mathbf{D_1}##
##\mathbf{D_2}##
##\mathbf{D_3}##
##\mathbf{D_4}##
##\mathbf{O_1}##
##c_{11}##...
I know how to get fusion cross section plots from the exfor website but now I need to plot the reaction rate as a function of temperature. According to the image, I have sigma and E values as x and y data. How do I integrate using MATLAB .
hi guys
i was trying to use this shooting algorithm from Xue and Chen Scientific Computing with MATLAB book :
to solve this non linear temperature distribution problem :
i checked my Matlab function multiple times but i am keep getting a nonsense graph for the temperature , can someone cheak...
We have to submit a Matlab (my worst module) assignment to show the heat transfer on a plate. However, I have the 2 codes almost done but I am struggling to write the report. To calculate the temperature on a 2D aluminum plate we need to use the Explicit Finite Difference Method. The problem...
The test case for the block of code below is:
y0=10,
f=@(t,y) -0.5*y,
[t,y]=euler_method_attempt(f,0,5,y0,10)
This code below works and is the correct answer, but I am confused on some parts of it. When indexing the for loop it seems as if the first output for "y" would be y(2), not y(1). And...
hi guys
i was trying to solve this non linear ode using the shooting algorithm in Matlab :
i am not sure how to solve it using the normal shooting algorithm i have , since no other boundary at x = L/2 was given to check the shooting ?!
function dTdx = bar_temp(x,y)
k = 72;
h = 2000;
epsilon =...
I tried to simulate the circuit but I got unreliable results. Here's what I got when I set the duty cycle to be 20%:
Stop Time = 0.02
The efficiency is more than100%.
Here's the parameters:
Could someone please let me where is my mistake?
%Debeye theory Heat Capacity of Copper
%Garcia Problem 10.16
%Find molar heat capacity from 0-1083K (melting point of Cu)
k = 1.38064852e-23; %Boltzmann's constant
N = 6.02214e23; %Avagadro's number (atoms per mol)
T = 0:1083 ; %Initialize Temp at 0K-1083K
theta = 309; %Debeye temp of Cu (K)...
hi guys
i am having some truble solving a simple 2body problem in MATLAB , basicaly i have a table of data that came from a simulation of a satellite orbiting the Earth with 1 min interval between them , i will only take the first inital position and velocity from that table and i sould...
hi guys
i am trying to code an algorithm for computing the trajectory of a basic two body problem situation according to the equation
$$\ddot{r} = \frac{-\mu}{r^3} \vec{r}$$
i am trying to use the Euler method , but the problem is in converting this problem into a 3 separate equations one for...
FTCS scheme
My Matlab code:
%Problem 3
%Solve diffusion problem using Richardson scheme or DuFort-Frankel scheme
clear all;
scheme = menu('Choose method of solving diffusion equation:', 'Richardson', 'DuFort-Frankel');
tau = input('Enter time step: ');
N = input('Enter the number of grid...
The task is to given an input column vector (with values between -1 and 1 representing the digitized data), fs the sampling rate, delay to represent the delay of the echo in seconds, amp specifying the amplification of the echo, to add this echo to the original signal after delay seconds.
Other...
I am trying to solve a PDE (which I believe can be approximated as an ODE). I have tried to solve it using 4th Order Runge-Kutta in MATLAB, but have struggled with convergence, even at an extremely high number of steps (N=100,000,000). The PDE is:
\frac{\partial^2 E(z)}{\partial z^2} +...
Hi! First off, I'm just an upcoming junior in Civil Engineering, and I have little teaching experience. I have done well in engineering classes so far though, and I've thought about ways to improve how classes are taught. While there are some widgets for engineering, like those in MATHTAB and...
For clarification on "normal incidence" without drawing a picture.
I'm going to assume the incoming wave has the electric field in the z-direction, the magnetic B / Auxillary H-field in the x-direction, and the Poynting Vector in the y-direction (i.e. normal to the plane of the aperture).
That...
Hi,
I'm not sure if I should be asking this but I couldn't make sense of the following Matlab command: length max([2+3-1,2,3]). The result is "16". I couldn't the operation of this command and why it produces the result of "16". Could you please help me with?
Hi
I have saved data in pdf format, and I wish to generate a plot from this data.
The data is iterations of optimising some function.
I can't just copy and paste it into the live window obviously and then try to generate a figure, so how can I generate a figure, just as I would have done...
Here's my attempt:
The results I got are close to the required answer, but there is a question telling:
I tried to solve it, but Isc and Vt (in open circuit) are decreasing with the increase of the field current , so I didn't get the right answer. Could someone let me know where is my...
Hi,
So i am in a fix now. I have a discrete time signal which is produced by a device with Nyquist frequency as 50MHz and 1088 samples (there is nothing i can do with the device to change the frequency or number of samples). I have an analytical signal which is produced in the frequency domain...
Introduction: I am writing a Matlab program that solves the Kepler problem for any Elliptical, Hyperbolic, or Circular orbit. Given an initial position vector, velocity vector, find the position vector and velocity vector after some given time. I am not doing this for any class, I have been...
At the start up section I initialize a matrix like:
EL = [ ];
save('EL.mat',"EL");
-------------------------------------------------- This part is okay it creates and saves an empty matrix.
But later, when a button pushed it should record the values of the edit box like:
(This is the...
I use the following script and function in MatLab, but get three errors.
I shall first write down the code and after that the errors that I get.
function yprime = lorenz_de(t,y)
%LORENZ_DE Lorenz equations.
% yprime = lorenz_de(t,y).
yprime = [10*(y(2)-y(1))...
Construct the circuit above using the block shown below.
The torque was gradually increased in small steps until the load torque reached the rated torque. At each step the torque, current speed, voltage and power factor was measured and the result record in Table (1).
Tn = Rated torque = 1 Nm...
Here is the documentation for the 2DFFT:
https://www.mathworks.com/help/matlab/ref/fft2.html
how would I go about creating this formula on MATLAB to apply it on an image? My guess is that I need to create the equation and then multiply it to the image I need such as:
$$U = VI$$
where V is my...
I used the same code , but changing the equation ( line 4). In part (D) , I got a complex number , does it mean that the function is divergence ?
Here's my code :
Part c :
Part d :
Could someone confirm my answer please ? Any help would be greatly appreciated !
I researched the solar collectors implemented in practice for water detoxification and I found out that the preferred design is the Compound Parabolic Concentrator. Knowing that I have no information regarding radiation beyond what's taught generally in heat transfer courses in chemical...
Hello PF,
I need some guide points to help me formulate a project idea on the topic of optical fibers.
Namely, the professor suggested I should look for topics on modeling of optical fibers, analysis of different optical fibers, characteristics etc. and to work in a simulator, or perform a...
I've attached a .txt file of my script for those who want to take a look at it
Here's a picture of my vector field at time t = 0
I'm very concerned about this picture because from my understanding the Poynting vector is supposed to point outwards and not loop back around, this looks nothing...
Hello All,
So I know how to solve this problem, but I don't understand it.
I first create a vector for length and width:
L=[1 3 5]
W=[2 4 6 8]
I then use meshgrid to make my L and W vectors have the same dimensions.
[X,Y]=meshgrid(L,W)
Then multiply X and Y together using array multiply (not...
I am trying to model an evaporator which evaporates water to steam in Matlab/simulink. Are there any governing equations i need to know and follow when modelling the evaporator mathematically? Please let me know.
Hi, as I anticipated, I've been using MATLAB and MATLAB only during all my BS and my MS degree. Since it is very expensive I don't think I will get a new license once my student one expires. I don't really have much time now to learn a completely different programming language because I have a...