Matlab Definition and 1000 Threads

  1. F

    MATLAB Can I calculate the covariance matrix of a large set of data?

    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...
  2. T

    MATLAB Matlab help — How to replace a word using findstr?

    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?
  3. tworitdash

    MATLAB Creating and recovering a frequency shift in time domain in MATLAB

    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...
  4. C

    A Has anybody programmed the mcKL expansion?

    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...
  5. C

    MATLAB Problem with Karhunen-Loève expansion in matlab

    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...
  6. S

    MATLAB How can I plot a Hohmann Transfer Orbit in MATLAB using ode45?

    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 =...
  7. S

    MATLAB Calculating the time taken for an asteroid mission using MATLAB

    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...
  8. Will26040

    MATLAB MATLAB Plug flow reactor optimisation Problem

    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...
  9. tworitdash

    MATLAB How to change the frequency values inside a time domain signal phase

    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...
  10. S

    MATLAB How to plot an orbit around the Earth in MATLAB

    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)...
  11. S

    MATLAB Question about how solve 2 body problem in orbit using MATLAB ode45

    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...
  12. D

    Tetrahedron Simplex Shape Functions in FEA

    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...
  13. F

    Find Z-bus using Z building algorithm using MATLAB code

    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...
  14. A

    Help with Matlab Problem: Commenting Code & Finding Errors

    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...
  15. F

    Write MATLAB code to find Y bus for any bus system

    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...
  16. Wrichik Basu

    MATLAB Solving transportation problems (LPP) using linprog in MATLAB

    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}##...
  17. R

    MATLAB Plotting Reaction Rate vs Temperature with MATLAB

    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 .
  18. patric44

    Non linear BVP using a shooting algoritm with 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...
  19. T

    Matlab report help please (Finite Difference Method)

    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...
  20. cookiemnstr510510

    Matlab for loop indexing confusion

    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...
  21. patric44

    Temperature Distribution of Current Carrying Wire in Matlab

    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 =...
  22. F

    Simulate a Chopper of Class A circuit in MATLAB Simulink

    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?
  23. J

    Matlab How to plot values from a loop

    %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)...
  24. patric44

    Using Matlab ode45 to solve a simple 2 body problem

    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...
  25. patric44

    Solving the two body problem in Matlab

    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...
  26. J

    Matlab coding issue with solving PDEs

    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...
  27. WhiteWolf98

    MATLAB How to make a while loop stop when reaching a certain value

    m_1 = 1; C_p1 = 2219; T_1in = 100 + 273.15; T_1out = 75 + 273.15; Q_1 = (m_1)*C_p1*(T_1in-T_1out); while Q_1 ~= 30000 T_1outnew = T_1out + 0.1; Q_1 = (m_1)*C_p1*(T_1in-T_1outnew); T_1out = T_1outnew; end T_1outnew keeps increasing, but the code never stops; and naturally, Q...
  28. binbagsss

    MATLAB Matlab: echo generator question

    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...
  29. J

    A Nonlinear Wave Equation (Nonlinear Helmholtz)

    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} +...
  30. person123

    Widgets for Visualizing Engineering

    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...
  31. P

    Babinet's Principle: Effective Aperture Dipoles (Matlab)

    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...
  32. PainterGuy

    MATLAB Matlab command question: length max([x+y-1,x,y])

    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?
  33. binbagsss

    MATLAB Matlab help please (generating a plot from this data)

    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...
  34. F

    Simulate open circuit and short circuit in MATLAB

    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...
  35. C

    MATLAB Deconvolving two signals with different sampling rates

    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...
  36. J

    MATLAB Writing a matlab program to solve the Kepler Problem (Universal Vars)

    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...
  37. mastermechanic

    Matlab Appdesigner save('xxx.mat') command won't work

    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...
  38. MathematicalPhysicist

    MATLAB A Lorenz's system of ODEs doesn't get executed in Matlab

    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))...
  39. F

    Construct a circuit with single phase asynchronous machine in MATLAB

    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...
  40. Boltzman Oscillation

    MATLAB How can I create an equation in matlab for image processing?

    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...
  41. F

    Fixed-point Iteration in MATLAB

    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 !
  42. F

    Solve a nonlinear equation using fixed-point iteration in MATLAB

    My attempt is attached below. When I tried to solve it , nothing comes up. However, there are no errors !
  43. A

    Finding the Reaction Scheme for Photocatalytic Oxidation of Phenol

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

    Modeling/Analysis of optical fibers

    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...
  45. P

    Plotting the Poynting vector of a radiating electric dipole [matlab]

    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...
  46. currently

    MATLAB Position-Velocity phase plane portrait in MATLAB?

    For example, how would I graph a Position-Velocity phase portrait of a nodal sink or spiral sink? Given form of mx'' = -cx' - kx + βx^3.
  47. cookiemnstr510510

    Solving MATLAB Meshgrid: A Beginner's Guide

    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...
  48. V

    Mathematical Modeling of an evaporator for evaporating water

    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.
  49. dRic2

    MATLAB Switching from MATLAB - Easier Programming Language?

    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...
Back
Top