Beantwortet
How to solve for three answers from 3 equations using fsolve
Below, see an example of how to solve the system. I had to make up the values of the constants since you have not specified the...

fast 4 Jahre vor | 0

| akzeptiert

Beantwortet
Adding every loop a matrix from the right side to a matrix
In the example below, a new 2x2 random matrix is created at each new iteration and appended to an existing matrix A. clear,clc ...

fast 4 Jahre vor | 0

Beantwortet
assigning argument of function within function
The error is in the last line of the function fix. Change that and the code works. fix(rand(1,10)) % complete function funct...

fast 4 Jahre vor | 0

Beantwortet
conversion of yes no into logical array
clear,clc T = readtable('gridstability.csv') If you are ok with T.stabf being populated by true/false values, you can use. T....

fast 4 Jahre vor | 0

| akzeptiert

Beantwortet
I have to create a square wave signal on simulink where any logical value, high or low, must last for a given time. Logical values and times are sent by other simulink blocks.
Maybe something like this? clear,clc T = [3,6,2,1,4,3,8]; V = [1,0,1,0,1,0,1]; % Block t = cumsum(T); t = [0,repelem(t...

fast 4 Jahre vor | 0

Beantwortet
How do I find sin of a cell variable (el)?
If the value is stores in a cell, then you should write el{PRN,t} in order to extract the value as a double.

fast 4 Jahre vor | 0

Beantwortet
Sort a variables in structure
See example below clear,clc s.var_1 = 1; s.var_6 = 1; s.var_3 = 1; s.var_2 = 1; s.var_5 = 1; s.var_4 = 1; s order...

fast 4 Jahre vor | 0

| akzeptiert

Beantwortet
Runga-Kutta Method for system of first order differential equations
Two things: 1 - By defining two different functions for y1 and y2 you decouple the system, which is the source of the main prob...

fast 4 Jahre vor | 0

| akzeptiert

Beantwortet
Free Radical Polymerization for Copolymers AA and Styrene using pseudokinetic rate constants
You just need to calculate all the quantitites inside the ODE function as well. If you need those quantities to be plotted, the...

fast 4 Jahre vor | 0

| akzeptiert

Beantwortet
Fitting data to a known function using numerical solution
I suggest an extensive reading of the following documentation https://ch.mathworks.com/help/curvefit/fit.html https://ch.mathw...

fast 4 Jahre vor | 0

| akzeptiert

Beantwortet
2nd order diff equation for ode23/45?
The way you coded the ODE system is incorrect. See below clear,clc % Numerical solution tspan = [1 4]; y0 =...

fast 4 Jahre vor | 1

| akzeptiert

Beantwortet
Writing a loop to create a matrix
Example A = rand(3) n = 10; lambda = []; for i = 1:n lambda = [lambda;A.^i]; end lambda

fast 4 Jahre vor | 1

| akzeptiert

Beantwortet
Diagonal sums with non-zero elements
%define A A = [0 0.4 0.3 0.3; 0 0 0.5 0.5; 0.5 0.3 0 0.2; 0.5 0.3 0.2 0]; [n,n] = size(A); %find all permutations of A B =...

fast 4 Jahre vor | 1

Beantwortet
how to count the number of lines of an external txt file
Not sure if there is a better way, but this will work fid = fopen('a.txt','r'); n = 0; while ~feof(fid) fgetl(fid); ...

fast 4 Jahre vor | 0

Beantwortet
Plotting differential equations using ODEs with multiple initial conditions, trying to recreate a plot
I could not run the code, because several constants are missing (e.g. alpha1,beta1 etc.) The error in your code is that you hav...

fast 4 Jahre vor | 0

Beantwortet
Unrecognized function or variable 'qdpfun"
Below, I show the right way to pass extra parameters to a function. clear,clc dP = -18*1.01325e5; dz = 100; rho = 1e3; ...

fast 4 Jahre vor | 1

| akzeptiert

Beantwortet
Can someone help me understand why I cant get a graph with an alpha of 0.001
Following @Jan comprehensive answer, I think a code like the one suggested below might be a good solution to your problem clear...

fast 4 Jahre vor | 1

Beantwortet
find indexes of two values that between them there is specific number
clear,clc A = [1 5 3 10 38 27]; B = 2; % Interpolattion values idx = 1:2:2*length(A)-1; newA = interp1(idx,A,1:idx(end...

fast 4 Jahre vor | 0

Beantwortet
Runge-Kutta for multiple variables
Hi @Juliana Quintana, the problem is that by defining 4 different function handles and 4 different loops, you have decoupled the...

fast 4 Jahre vor | 1

| akzeptiert

Beantwortet
How to make vector of Unicode characters align with 1x2 matrix of numbers
clear,clc playerCards = []; storeUnicode = []; allSuites = [9824 9827 9829 9830]; % all possible uni...

fast 4 Jahre vor | 0

| akzeptiert

Beantwortet
Plot differential equations with respect to two variables in a 3d plane
You can use surf https://ch.mathworks.com/help/matlab/ref/surf.html or contourf https://ch.mathworks.com/help/matlab/ref/cont...

fast 4 Jahre vor | 0

| akzeptiert

Beantwortet
Append results of two 'for loops' into a single variable
You could store the accuracies of the first loop into a variable named a1 and those of the second loop into a variables named a2...

fast 4 Jahre vor | 0

Beantwortet
how to draw contour plot
The problem was in your use of linspace x = linspace(0,0.05,100); y = linspace(0,1,100); [xm,ym] = meshgrid(x,y); R0 = xm....

fast 4 Jahre vor | 1

Beantwortet
How can I make a integration with trapz?
I don't think you really need trapz for this function clear,clc x=[0,-0.0476,-0.0476,-0.0952,-0.0952,-0.1429,-0.1429,-0.1905...

fast 4 Jahre vor | 0

Beantwortet
How to run multiple randi fucntions with for loop without having indicing problems. (nearest neighbor interaction problem).
clear, clc for idx = 1:1000 M = randi([0, 1], 12, 12); M(M == 0) = -1; M(:,[1 end]) = 0; M([1 ...

fast 4 Jahre vor | 0

| akzeptiert

Beantwortet
How to vary an element in a matrix?
clear,clc k1 = 0.5*180:1.5*180; k2 = 50; k3 = 220; m1 = 1.1; m2 = 3.4; omega_nf = zeros(2,length(k1)); for idx = ...

fast 4 Jahre vor | 0

Beantwortet
superimpose a line of slope (-5/3) on a log-log graph
See example below clear,clc x = [1e1,1e4]; slope = -3/5; offset = 1; y = slope*x+offset; loglog(x,y,'--r')

fast 4 Jahre vor | 0

Gelöst


The Hitchhiker's Guide to MATLAB
Output logical "true" if the input is the answer to life, the universe and everything. Otherwise, output logical "false".

fast 4 Jahre vor

Beantwortet
Sum cumulative value from all files that is summoned in a loop
Inside the loop write row_length(i) = length(dataset.time); After the loop, you can calculate the summ of all lengths with su...

fast 4 Jahre vor | 0

| akzeptiert

Beantwortet
Make a point move to a destination coordinate
I am not sure what you mean when you say "there is no graph used", but maybe something like the exa,ple below might help. clear...

fast 4 Jahre vor | 0

| akzeptiert

Mehr laden