Answered
The coolest ODE function and plot in MATLAB
For me, I think that would be any variation of the Rayleigh-Plesset equation, which describes the volume oscillations of a bubbl...

4 years ago | 2

Answered
Surf or Mesh plot
Try this clear,clc t = linspace(0,100,5100); y = 1:34; [t,y] = meshgrid(t,y); A = 2./(t+1)+y.^2; surf(t,y,A,'EdgeC...

4 years ago | 0

Answered
loop of Column Average
There's no need to use a for loop. Try the code below. clear,clc A = rand(1024,78); % initial matrix o...

4 years ago | 0

| accepted

Answered
I am trying to solve a coupled set of ODE's different ways. (1) using ode45 which I have been able to do (2) solve them using Euler's method and (3) Heun's method
Try the code below clear,clc %%%%%%%%%%%%%%%%%%%%%%%%% constants %%%%%%%%%%%%%%%%%%%%%%%%%%%% k1 = 0.5; k2 = 0.06; k3 ...

4 years ago | 1

| accepted

Answered
I have query in graph plotting.
Try using meshgrid z1 = -4:0.1:4; a11 = -4:0.1:4; [z1,a11] = meshgrid(z1,a11); G = atan(((0.03 + a11)./z1)) + atan((0.05...

4 years ago | 0

Answered
Finding the value of the below curve
Hi again @Amy Topaz XD See below. I have done the procedure for one curve only, so to make it clearer. z1 = [0.00008 0.009]';...

4 years ago | 0

Answered
Indicating the maximum value
z1 = [0.00008 0.009]'; a11 = -1:0.001:1; k1 = atan(((0.01/2 + a11)./z1)) + atan((0.01/2 - a11)./z1); [~,idx_k1] = max(k1,[],2...

4 years ago | 1

| accepted

Answered
get two sum of two random number are not the same
If you need just 2 random integers as an output, you should do this % Main file sendCard % Function file function sendCard...

4 years ago | 1

| accepted

Answered
Use nested for loops to compare neighboring values within a matrix
Hi Brayden, I am going to give you an example of how this could be done. In order to do so, let me create a matrix z that cont...

4 years ago | 0

Answered
Error plotting (Vector must be the same length)
The vector A has 19 elements, whereas t and E have 20. clear all clc f=@(t,y) 4*y.^2; F = @(t) 1/(...

4 years ago | 0

Answered
Surface plot function with two variable
Your x and t spans are not convenient. Try this f = 0.5; tau = 1/f; c = 3*10^8; lambda = c/f; phi = 0;...

4 years ago | 1

| accepted

Answered
Solving system of quadratic equations
I am not really confident with Simulink, but it does work on Matlab using the fsolve function. In the equation, I changed z1 an...

4 years ago | 0

| accepted

Answered
Plot does not appear.
No need for a for loop E1=1:73; W=15; L=1.3; w=0.25; h=0.075; I=(w*h^3)/12; Deflection5 = (W.*L.^3)./(3.*E1.*I); plot(E1...

4 years ago | 0

Answered
Area under a peak
clear,clc A = readtable('875nm.txt'); x = A.Var1; y = A.Var2; [~,imax] = max(y); % Total area area_tot = trapz(x,y) %...

4 years ago | 0

Answered
I am looking for P in this equation in Matlab
Hopefully this will help @Pooya Jahedi too. clear,clc alpha = 0.5; kH = 1; P0 = 1; qm = 2; kS = 0.01; n ...

4 years ago | 0

Answered
im trying to create a function that wors the same way as the unique() function without using it
This is rudimentary, but it might be a starting point. clear, clc A = [1 2 3 4 5 6 7 8 2 9 2 1 5]; uniqueA = ismatch(...

4 years ago | 0

| accepted

Answered
get the minimum and maximum element from two vectors.
You could use the min and max MatLab inbuilt functions. v1 = [1 4]; v2 = [4 -1]; [num1 num2] = minMaxVectors(v1,v2); disp([n...

4 years ago | 0

| accepted

Answered
mapping matrix of two vectors
clear,clc A = [1;2;3;4]; B = [3;1;4;2]; C = A == B'

4 years ago | 0

| accepted

Answered
Solving a mathematical equation
Example clear,clc beta = 0.5; kH = 1; P0 = 1; qm = 2; kS = 0.01; n = 2; qx = 1; func = @(P) qx-(beta...

4 years ago | 0

Answered
Combining two or more elements of vectors into 1
The problem I see is that z cannot be an array of doubles, since 010 and 001 would be just 10 and 1 respectively. You could try ...

4 years ago | 0

Answered
how to read a table and multiply its elements with eachother and store it in another table
Example %% Creating an example table T = array2table(rand(152,3)); T.Properties.VariableNames = {'A','B','C'}; disp(T) %% N...

4 years ago | 0

Answered
Find the common elements in same indices in two arrays.
clear,clc A = [1001 1002 1003 2001 2002 1004 1005 2003 2004 2005]; B = [1001 1002 2001 2...

4 years ago | 0

| accepted

Answered
Two Matrices comparison with incrementing column of 2nd matrix
clear,clc %% LOAD THE DATA load unitydata %% MOVING AVERAGE CALCULATIONS fastSMARange = 25; slowSMARange = 50; fastSMA...

4 years ago | 0

| accepted

Answered
Combined Sine wave with multiple amplitudes
Do this, f = 50; T = 1/f; t1 = linspace(0,5*T,1000); wave1 = sin(2*pi*f*t1); t2 = linspace(5*T,8*T,1000); wave2 ...

4 years ago | 0

| accepted

Answered
how to unite two curves smoothly in matlab?
This should work clc, clear, clf Ku_eGR_IL_WG_S21 =xlsread('Ku_eGR_IL_WG.xlsx','H:H'); % A S21 magnitude frequency =xlsread...

4 years ago | 1

| accepted

Answered
Cycle of operations on vector sections
The problem is myfun spits out two vectors of size 1 x step+1. You could assign this vectors to the rows of a new matrix (see a...

4 years ago | 0

| accepted

Answered
Find minimal possible term x by trying out various combinations of other terms for a known sum
This may be an approach a = 2; % Can be repeated 128 times max b = 3.5; ...

4 years ago | 0

Answered
can't understand this statement
Yes, it extracts the terms on column 3 and rows 1 and 2 of b. Example b = magic(5) b(1:2,3)

4 years ago | 0

Answered
Why two methods give different results, and which is correct?
Since you have an implicit ODE, the correct solution is given by ode15i. The problem with ode45 is in the initial guess used to...

4 years ago | 0

| accepted

Answered
how do I solve a quadratic which contains a changing b value
Does this help? clear,clc v0=34.7; % initial velocity in m/s. Restricted to a maximum of 125 km/h prompt = "what is the ang...

4 years ago | 0

Load more