Respondida
How to remove rows from an array where there is a 1 in a logical array of the same dimensions
The one below is just an example of how to use logical indexing for your problem. data = ones(1,100); data(randi(100,1,10)) = ...

más de 3 años hace | 0

Respondida
Help with coding a model
I think this could be the solution to your problem % Parameters L = 80; gamma = 1e-2; R_0 = 0.7; beta = R_0*...

más de 3 años hace | 1

| aceptada

Respondida
How do I use a variable assigned in one function to call another function?
The code does not global variables at all a = 5; b = 10; x = name1(a,b) y = name2(x,b) function out = name1(var1,var2) ...

más de 3 años hace | 0

Respondida
Plot polynomial using Eueler's method
so, initially, you calculate the analytical derivative of the function using the symbolic environment syms x y = x^3+x^2-12*...

más de 3 años hace | 1

| aceptada

Respondida
Fill area inside a single curve with color without an outline?
You should remove unnecessary spaces (' EdgeColor' --> 'EdgeColor'). A = [3.538283063 300.2169197 3.712296984 321.9088937 ...

más de 3 años hace | 0

| aceptada

Respondida
Create an array from file names to find if any files are missing
Take this example, where there should be a total of 4 files but file #3 is missing n = 4; % nu...

más de 3 años hace | 0

Respondida
Need to fill out skipped rows in a matrix
Take this example complete = [(1:10)',rand(10,1)] partial = [sort(randperm(10,6))',rand(6,1)] You can apply the following to ...

más de 3 años hace | 0

| aceptada

Respondida
ismember for cell arrays of different sizes
bin_list = {[1], [1,7], [1,7], [1,7,9], [2,8], [3], [1,7]}' cellfun(@(x)ismember(1,x),bin_list)

más de 3 años hace | 0

| aceptada

Respondida
Plot elipses with a foci based on equations to plot flowers
The code below does the job drawing the figure, but not the coloring. I can't run it online (takes too long). clear,clc figur...

más de 3 años hace | 1

| aceptada

Respondida
How can i plot dy/dx function?
You can use deval in combination with solution structure. xspan = (30:0.1:900); y0 = 0; opts = odeset('AbsTol',1e-8,'RelTol',...

más de 3 años hace | 0

| aceptada

Respondida
What is wrong with the function code when it can work perfectly without function code
The value of for tol differs of two orders of magnitude in the examples you gave (i.e., you used 0.001 in the function call, 0.0...

más de 3 años hace | 0

Respondida
Im trying to use the integral function without any success...
syms t f = exp(-t/3)* sin(t^2); I = int(f,t,1,4) This means int cannot compute the value of the definite integral. You could ...

más de 3 años hace | 0

Respondida
I'm getting an error (Index in position 1 exceeds array bounds)
Do this instead ind_out = signal(1,:) > max_thresh; %find index of point>thresh onset = signal(ind_out,1); %return onset ...

más de 3 años hace | 0

Respondida
Count occurances on multidimensional matrix with multiple criteia on different dimnesions
A(:,:,1) = [ 90 95 90 80;... 70 90 95 70;... 60 90 90 60;... ]; A(:,:,2) ...

más de 3 años hace | 0

Resuelto


Magic is simple (for beginners)
Determine for a magic square of order n, the magic sum m. For example m=15 for a magic square of order 3.

más de 3 años hace

Resuelto


Make a random, non-repeating vector.
This is a basic MATLAB operation. It is for instructional purposes. --- If you want to get a random permutation of integer...

más de 3 años hace

Resuelto


Number of 1s in a binary string
Find the number of 1s in the given binary string. Example. If the input string is '1100101', the output is 4. If the input stri...

más de 3 años hace

Resuelto


Create times-tables
At one time or another, we all had to memorize boring times tables. 5 times 5 is 25. 5 times 6 is 30. 12 times 12 is way more th...

más de 3 años hace

Resuelto


Return the first and last characters of a character array
Return the first and last character of a string, concatenated together. If there is only one character in the string, the functi...

más de 3 años hace

Respondida
Can someone explain to me how to code the Tangent line and Normal line
syms x m b yt f(x) = 3^x+3*x+2; % Function m = diff(f,x) % Slope of tangent ...

más de 3 años hace | 0

Respondida
Finding specific values from a matrix
See the example below (I used a smaller array for better readibility) Values = randi(200,1,20) lower_limit=30; upper_limit=10...

más de 3 años hace | 0

| aceptada

Respondida
Using fsolve in simulink with a different equation each time
In Simulink, you can keep a as a generic parameter syms x a eqn = (450 + 75 * cos(x) - 450 * cos(a))^2 + (110 + 450 * sin(a) -...

más de 3 años hace | 0

| aceptada

Respondida
find and store the index value of maximum or minimum value of cell array
Example for row = 1:613 yourcellarray(row,1) = {randi(100,200,1)}; end yourcellarray yourcellarray{1} Above is just an...

más de 3 años hace | 0

Respondida
Help with Graphing Difference Equations
n = 10; x = zeros(1,10); x(1) = 2; x(2) = 5; for idx = 3:n x(idx) = 5*x(idx-1)-6*x(idx-2); end semilogy(1:n,x)

más de 3 años hace | 0

| aceptada

Respondida
Running for loop on an equation
I suspect you want to do something like this S = [ 1/2, 1/3, 1/2, 1/3, 1/3, 1/2;... 1/2, 0, 0, 0, 0, 0;... ...

más de 3 años hace | 1

Respondida
perimeter , area of circle
You just need to change the arguments in fprintf, since you must have accidentally swapped them. r = 1; P = pi * 2 * r; S = p...

más de 3 años hace | 0

| aceptada

Respondida
How to apply stop time condition with multiple time intervals?
n=100; time = 0; for i = 1:n if sum(time) >= 35 fprintf('You run out of time') break end ...

más de 3 años hace | 1

| aceptada

Respondida
How do I find a maximum within a certain range
Take this example dataset x = linspace(0,10,100); y = randi(10,1,100).*sin(x); plot(x,y) Now assume you want to find the max...

más de 3 años hace | 0

Respondida
Method of lines to solve unsteady state PFR with multiple reactions
I deleted many commented lines for clarity. clear, clc k0 = [0.1023 0.0011 0.0129 0.0000001 0.0008 0.000001 0.163 0.5 0.01 0...

más de 3 años hace | 1

Respondida
Help with time dependent ODE with a piece-wise component
I think that the problem is that you already defined the ODE system as an anonymous function, therefore there's no need to call ...

más de 3 años hace | 0

| aceptada

Cargar más