回答済み
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...

約4年 前 | 0

| 採用済み

回答済み
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 ...

約4年 前 | 0

回答済み
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...

約4年 前 | 0

回答済み
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....

約4年 前 | 0

| 採用済み

回答済み
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...

約4年 前 | 0

回答済み
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.

約4年 前 | 0

回答済み
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...

約4年 前 | 0

| 採用済み

回答済み
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...

約4年 前 | 0

| 採用済み

回答済み
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...

約4年 前 | 0

| 採用済み

回答済み
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...

約4年 前 | 0

| 採用済み

回答済み
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 =...

約4年 前 | 1

| 採用済み

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

約4年 前 | 1

| 採用済み

回答済み
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 =...

約4年 前 | 1

回答済み
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); ...

約4年 前 | 0

回答済み
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...

約4年 前 | 0

回答済み
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; ...

約4年 前 | 1

| 採用済み

回答済み
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...

約4年 前 | 1

回答済み
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...

約4年 前 | 0

回答済み
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...

約4年 前 | 1

| 採用済み

回答済み
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...

約4年 前 | 0

| 採用済み

回答済み
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...

約4年 前 | 0

| 採用済み

回答済み
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...

約4年 前 | 0

回答済み
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....

約4年 前 | 1

回答済み
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...

約4年 前 | 0

回答済み
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 ...

約4年 前 | 0

| 採用済み

回答済み
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 = ...

約4年 前 | 0

回答済み
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')

約4年 前 | 0

解決済み


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".

約4年 前

回答済み
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...

約4年 前 | 0

| 採用済み

回答済み
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...

約4年 前 | 0

| 採用済み

さらに読み込む