Answered

I nee to write a code to solve a definite integral. The output format has to be fprintf.

syms x % f = -x.^3 + 3.x^2 - 2; % ^ this . should be * f = -x.^3 + 3*x^2 - 2; a=0; b=3; output = int(f, a, ...

I nee to write a code to solve a definite integral. The output format has to be fprintf.

syms x % f = -x.^3 + 3.x^2 - 2; % ^ this . should be * f = -x.^3 + 3*x^2 - 2; a=0; b=3; output = int(f, a, ...

5 days ago | 1

Answered

How to select consecutive rows at regular intervals?

% a matrix with 1000 rows and 5 columns M = (1:1000).'+(0:4) One way: A = M((20:50).'+(0:50:end-50),:); disp(A) Another w...

How to select consecutive rows at regular intervals?

% a matrix with 1000 rows and 5 columns M = (1:1000).'+(0:4) One way: A = M((20:50).'+(0:50:end-50),:); disp(A) Another w...

5 days ago | 0

| accepted

Answered

when and how to use dot multiplication

"but is .* needed in my above q equation?" Yes. t is a vector, and q0, R, L, and C are all scalars. q0=10;R=60;L=9;C=0.0005; ...

when and how to use dot multiplication

"but is .* needed in my above q equation?" Yes. t is a vector, and q0, R, L, and C are all scalars. q0=10;R=60;L=9;C=0.0005; ...

5 days ago | 1

Answered

How many legs 100 cows have

n_legs_per_cow = 4; % one cow has 4 legs n_cows = 1000; % 1000 cows n_legs_total = n_cows*n_legs_per_cow

How many legs 100 cows have

n_legs_per_cow = 4; % one cow has 4 legs n_cows = 1000; % 1000 cows n_legs_total = n_cows*n_legs_per_cow

5 days ago | 0

Answered

Error message "Index exceeds the number of array elements. Index must not exceed 3"

fsp is the cell array, and fsp{1,1} is the vector contained in the first element (first cell) of fsp. You are taking the length...

Error message "Index exceeds the number of array elements. Index must not exceed 3"

fsp is the cell array, and fsp{1,1} is the vector contained in the first element (first cell) of fsp. You are taking the length...

5 days ago | 0

| accepted

Answered

plotting title with multiple strings on one line

str_cell_array = {"abc\_def.h5" "ghi\_jkl.h5"}; str_title = strjoin(string(str_cell_array)," and ") title(str_title); figur...

plotting title with multiple strings on one line

str_cell_array = {"abc\_def.h5" "ghi\_jkl.h5"}; str_title = strjoin(string(str_cell_array)," and ") title(str_title); figur...

5 days ago | 0

| accepted

Answered

Applying one function in another function

CreateNeighbor() function sol = CreateRandomModel() sol = struct( ... 'sum_fburn_rand',rand(), ... 'fburn_rand',ra...

Applying one function in another function

CreateNeighbor() function sol = CreateRandomModel() sol = struct( ... 'sum_fburn_rand',rand(), ... 'fburn_rand',ra...

5 days ago | 0

Answered

May the number of decimal point be related with errors in matlab by using inpolygon and ismember functions?

"I am asking how it is possible?" MagnitudesOfEventsInAreaSource1{i} can have more than NumofeqsinArea1{i} elements if Catalog ...

May the number of decimal point be related with errors in matlab by using inpolygon and ismember functions?

"I am asking how it is possible?" MagnitudesOfEventsInAreaSource1{i} can have more than NumofeqsinArea1{i} elements if Catalog ...

5 days ago | 0

| accepted

Answered

replace specific empty columns by 0 in cell MATLAB?

% reproduction of your cell array: C = repmat({NaN},7,15); C(1:4,11:15) = {0}; C(5:7,5:15) = {0}; C{1,1} = '0.x'; C{2,2} = ...

replace specific empty columns by 0 in cell MATLAB?

% reproduction of your cell array: C = repmat({NaN},7,15); C(1:4,11:15) = {0}; C(5:7,5:15) = {0}; C{1,1} = '0.x'; C{2,2} = ...

5 days ago | 0

| accepted

Answered

interpreter with backlash underscores

The easiest way to fix this might be not to use an interpreter: subplot(2,1,1) xlim([-1 1]) set(gca(),'XTick',0,'XTickLabels'...

interpreter with backlash underscores

The easiest way to fix this might be not to use an interpreter: subplot(2,1,1) xlim([-1 1]) set(gca(),'XTick',0,'XTickLabels'...

5 days ago | 0

| accepted

Answered

How to disable figure pop up while initializing hggroup?

hggroup() creates an hggroup in the current axes in the current figure. If there is no current figure, then a new figure is cre...

How to disable figure pop up while initializing hggroup?

hggroup() creates an hggroup in the current axes in the current figure. If there is no current figure, then a new figure is cre...

5 days ago | 0

Answered

Use only a certain range of values for a function

truncated_z = z(t_z <= 3);

Use only a certain range of values for a function

truncated_z = z(t_z <= 3);

5 days ago | 0

| accepted

Answered

Matching columns of arrays to fill up a corresponding empty column

load('OCV_new.mat') load('SoC_internal_new.mat') load('SOC.mat') It looks like SoC_internal_new is not values between 0 and 1...

Matching columns of arrays to fill up a corresponding empty column

load('OCV_new.mat') load('SoC_internal_new.mat') load('SOC.mat') It looks like SoC_internal_new is not values between 0 and 1...

5 days ago | 1

Answered

I can't seem to call an integral function inside of a plot that has any complexity. I need to plot outputs of a range of values for the integral.

You're calling int with two different sets of inputs and asking why one works and one doesn't, right? The line: plot(x,Wthr.P_...

I can't seem to call an integral function inside of a plot that has any complexity. I need to plot outputs of a range of values for the integral.

You're calling int with two different sets of inputs and asking why one works and one doesn't, right? The line: plot(x,Wthr.P_...

5 days ago | 0

Answered

get xlabel,ylabel,title from premade plots

I don't think this will work for every premade plot, but it seems to work for plots created with rlocus H=tf([1],[1 1]); rlocu...

get xlabel,ylabel,title from premade plots

I don't think this will work for every premade plot, but it seems to work for plots created with rlocus H=tf([1],[1 1]); rlocu...

5 days ago | 1

| accepted

Answered

I would like to mark the Minima of my colormap (scatter plot), because the Minima is not directly apparent.

% some random data for demonstration: ff_r = 100*rand(50,1); ff_g = 100*rand(50,1); saved_data = rand(50,1); plotted_data = ...

I would like to mark the Minima of my colormap (scatter plot), because the Minima is not directly apparent.

% some random data for demonstration: ff_r = 100*rand(50,1); ff_g = 100*rand(50,1); saved_data = rand(50,1); plotted_data = ...

5 days ago | 0

Answered

Extracting data range from array problem

sampTurns = 5; ipArray=csvread('accel test drive 1.csv'); col1 = ipArray(:, 1); [peaks,peakIdx] = findpeaks(col1,'MinPeakDi...

Extracting data range from array problem

sampTurns = 5; ipArray=csvread('accel test drive 1.csv'); col1 = ipArray(:, 1); [peaks,peakIdx] = findpeaks(col1,'MinPeakDi...

5 days ago | 0

| accepted

Answered

How to get column values using indexes

S = load('matlab.mat'); A = S.Dataset23; result = splitapply(@(x){x(:,1:4)},A,findgroups(A(:,5)))

How to get column values using indexes

S = load('matlab.mat'); A = S.Dataset23; result = splitapply(@(x){x(:,1:4)},A,findgroups(A(:,5)))

5 days ago | 0

Answered

How to stop seperate axes plotting over the top of one anotner?

One way would be to plot into a new figure each time, instead of specifying to plot into figure 1 each time: x = [-10:1E-3:10];...

How to stop seperate axes plotting over the top of one anotner?

One way would be to plot into a new figure each time, instead of specifying to plot into figure 1 each time: x = [-10:1E-3:10];...

5 days ago | 0

| accepted

Answered

limit the search for maximums to a specific region

Instead of inputting the entire array into findpeaks, you can simply input the part of the array you want to search, and then ad...

limit the search for maximums to a specific region

Instead of inputting the entire array into findpeaks, you can simply input the part of the array you want to search, and then ad...

5 days ago | 0

| accepted

Answered

Does somebody know how to plot this function?

Use tand rather than tan, because the argument 3*x is in degrees rather than radians. Increase the number of points to see the ...

Does somebody know how to plot this function?

Use tand rather than tan, because the argument 3*x is in degrees rather than radians. Increase the number of points to see the ...

7 days ago | 1

| accepted

Answered

Unable to use a value of type cell as an index

Maybe the function compact_bbox defined below is close to what you have in mind. bbox_cell = { ... 'img1' [1 2 3] 'pothole...

Unable to use a value of type cell as an index

Maybe the function compact_bbox defined below is close to what you have in mind. bbox_cell = { ... 'img1' [1 2 3] 'pothole...

7 days ago | 0

| accepted

Answered

Legend of a plot out of table first row

I'm not sure where the legends are supposed to fit, but here you go: S = load('PegelpunktetimeseriesneuCopy'); Pegelpunktetime...

Legend of a plot out of table first row

I'm not sure where the legends are supposed to fit, but here you go: S = load('PegelpunktetimeseriesneuCopy'); Pegelpunktetime...

7 days ago | 0

Answered

Sort array of strings after criteria in the middle of each string

str = ["xer_cQwe" "po_bLo" "te_aUc"]; [~,idx] = sort(extractAfter(lower(str),'_')); sorted_str = str(idx)

Sort array of strings after criteria in the middle of each string

str = ["xer_cQwe" "po_bLo" "te_aUc"]; [~,idx] = sort(extractAfter(lower(str),'_')); sorted_str = str(idx)

7 days ago | 0

Answered

how to have a message that indicates me the experiment is done?

function Next_button_Callback(hObject, eventdata, handles) % hObject handle to Next_button (see GCBO) % eventdata reserved...

how to have a message that indicates me the experiment is done?

function Next_button_Callback(hObject, eventdata, handles) % hObject handle to Next_button (see GCBO) % eventdata reserved...

7 days ago | 0

| accepted

Answered

How can I choose certain parameters to choose different ways to calculate the determinant?

Below is a function get_det, made by adapting your code, which takes a matrix as its first input and a character vector specifyi...

How can I choose certain parameters to choose different ways to calculate the determinant?

Below is a function get_det, made by adapting your code, which takes a matrix as its first input and a character vector specifyi...

8 days ago | 0

Answered

Change xaxis from numbers to dates

x = 1:8760; y = x+5; figure() % plot(x,y) dt = datetime(2019,1,1,x-1,0,0); dt([1 end]) plot(dt,y) set(gca(),'XTick',datet...

Change xaxis from numbers to dates

x = 1:8760; y = x+5; figure() % plot(x,y) dt = datetime(2019,1,1,x-1,0,0); dt([1 end]) plot(dt,y) set(gca(),'XTick',datet...

10 days ago | 1

| accepted

Answered

4x1 Matrix of text from dynamic variables

Try this: Text = textscan(FID, '%s'); MatrixT1 = Text{1}([2 7 12 17])

4x1 Matrix of text from dynamic variables

Try this: Text = textscan(FID, '%s'); MatrixT1 = Text{1}([2 7 12 17])

10 days ago | 0

Answered

Invalid Subscript for Y, the table variable must be numeric array

First and Second are tables. Use curly braces {} rather than parentheses () to get the data out of a table: A = table([1;2;3;4;...

Invalid Subscript for Y, the table variable must be numeric array

First and Second are tables. Use curly braces {} rather than parentheses () to get the data out of a table: A = table([1;2;3;4;...

10 days ago | 0

| accepted