Answered

New to matlab. Why i get this answer?

syms y(t) yef(t); ymax=120*0.40680; yef(t)= 0.95*(1/(1+(y(t)/ymax)*y(t)+(1-(1/(1+(y(t)/ymax))*ymax)))); yo=0.40680*140; k10=...

New to matlab. Why i get this answer?

syms y(t) yef(t); ymax=120*0.40680; yef(t)= 0.95*(1/(1+(y(t)/ymax)*y(t)+(1-(1/(1+(y(t)/ymax))*ymax)))); yo=0.40680*140; k10=...

25 days ago | 0

| accepted

Answered

Deleting certain elements from an array without looping

The code Chunru wrote will work, but I have a few suggestions. Instead of using length, you should consider using numel as a ha...

Deleting certain elements from an array without looping

The code Chunru wrote will work, but I have a few suggestions. Instead of using length, you should consider using numel as a ha...

25 days ago | 1

| accepted

Answered

overlay bar plot without mixing color

Here is my solution, which allows you to specify the 3 face colors separately: A = [1;5;3;7;4]; B = [3;2;4;8;2]; shared=min(A...

overlay bar plot without mixing color

Here is my solution, which allows you to specify the 3 face colors separately: A = [1;5;3;7;4]; B = [3;2;4;8;2]; shared=min(A...

25 days ago | 1

| accepted

Answered

How do you create an array of date times given a starting date and number of days?

Vector1=1:5; Datetimevector = datetime(1900,1,1)+days(1:numel(Vector1))

How do you create an array of date times given a starting date and number of days?

Vector1=1:5; Datetimevector = datetime(1900,1,1)+days(1:numel(Vector1))

28 days ago | 0

| accepted

Answered

How to view a mat file that says preview too large to display Properly in Import Wizard

A mat file is a file, not a variable. It may contain variables. Judging from your description it only contains a single variable...

How to view a mat file that says preview too large to display Properly in Import Wizard

A mat file is a file, not a variable. It may contain variables. Judging from your description it only contains a single variable...

29 days ago | 0

| accepted

Answered

I not able to understand what type error I am making in the while loop

You aren't updating the value itself, so the calculation is the exact same on every iteration. function out = babyloniansqrt(S,...

I not able to understand what type error I am making in the while loop

You aren't updating the value itself, so the calculation is the exact same on every iteration. function out = babyloniansqrt(S,...

29 days ago | 0

Answered

Looking for alternative of extractBetween function

You need to come up with a regular expression that will exactly match what you want to extract. Below is my guess for what you w...

Looking for alternative of extractBetween function

You need to come up with a regular expression that will exactly match what you want to extract. Below is my guess for what you w...

29 days ago | 1

| accepted

Answered

What frustrates you about MATLAB? #2

Posted by @stephen williams on the original thread: The symbolic toolbox seems to have a lot of power, but it is not user frien...

What frustrates you about MATLAB? #2

Posted by @stephen williams on the original thread: The symbolic toolbox seems to have a lot of power, but it is not user frien...

30 days ago | 1

Answered

What frustrates you about MATLAB? #2

Posted by @Osmar Tormena JĂșnior on the original thread: I understand that being a Mac user I'm in a niche position. But I find ...

What frustrates you about MATLAB? #2

Posted by @Osmar Tormena JĂșnior on the original thread: I understand that being a Mac user I'm in a niche position. But I find ...

30 days ago | 0

Answered

How to create an interactive menu in the command window?

doc input Although in general a GUI will be nicer for your user. For general advice and examples for how to create a GUI (a...

How to create an interactive menu in the command window?

doc input Although in general a GUI will be nicer for your user. For general advice and examples for how to create a GUI (a...

1 month ago | 0

Answered

Creating a new table column that is the range of numbersbetween two other column

You can either use a loop, or hide the loop with rowfun: data=[54 119 60 129 177 119 183 129 ...

Creating a new table column that is the range of numbersbetween two other column

You can either use a loop, or hide the loop with rowfun: data=[54 119 60 129 177 119 183 129 ...

1 month ago | 0

Answered

How to increase the efficiency of this MATLAB program by using vectorization techniques

Arrayfun will only hide the loop, so it will never be faster than a plain for loop. What you need to do is change your function...

How to increase the efficiency of this MATLAB program by using vectorization techniques

Arrayfun will only hide the loop, so it will never be faster than a plain for loop. What you need to do is change your function...

1 month ago | 0

| accepted

Answered

c++ programming.

You forgot two things: This is a Matlab forum and nothing in your question is related to Matlab Every line should end with a s...

c++ programming.

You forgot two things: This is a Matlab forum and nothing in your question is related to Matlab Every line should end with a s...

1 month ago | 0

Answered

char array to cell array convert?

If you want to round your data, just use round: T = {[5.8882656], [0.01232356], [0.02556545],[0.035659595]}; T = cell2mat(T); ...

char array to cell array convert?

If you want to round your data, just use round: T = {[5.8882656], [0.01232356], [0.02556545],[0.035659595]}; T = cell2mat(T); ...

1 month ago | 0

| accepted

Answered

How to read a txt file with comma, text and numbers in matlab, and export the data

doc csvread

How to read a txt file with comma, text and numbers in matlab, and export the data

doc csvread

1 month ago | 1

Answered

curve fit a custom polynomial

You have two options: rewrite your equation to be a pure quadratic and use polyfit, or use a function like fit or fminsearch on ...

curve fit a custom polynomial

You have two options: rewrite your equation to be a pure quadratic and use polyfit, or use a function like fit or fminsearch on ...

1 month ago | 1

Answered

Update elements in matrix with condition

N = size(P,1); for k = 1:1:N if P(k,5) == 0 P(k,3) = P(k,1) + P(k,3); end end Similar code will allow y...

Update elements in matrix with condition

N = size(P,1); for k = 1:1:N if P(k,5) == 0 P(k,3) = P(k,1) + P(k,3); end end Similar code will allow y...

1 month ago | 0

Answered

how to convert 1x2 double into two 1x1

It looks like this is what you want: x=Time_msg_match(61649); x=x{1};

how to convert 1x2 double into two 1x1

It looks like this is what you want: x=Time_msg_match(61649); x=x{1};

1 month ago | 0

Answered

Is the formula given the same as the code?

Since the exponents range from -1 to -7, that means you will need 7 different values for t. One of the ways to achieve that is i...

Is the formula given the same as the code?

Since the exponents range from -1 to -7, that means you will need 7 different values for t. One of the ways to achieve that is i...

1 month ago | 0

| accepted

Answered

I have a code but it keep saying "invalid expression. when calling a function or indexing a variable, use parentheses. otherwise check for mismatched delimiters.

The reason is these two lines: xx1=(0,8.*pi,1000) x3=(-4,4) Did you maybe forget linspace? Anyway, this isn't valid Matlab s...

I have a code but it keep saying "invalid expression. when calling a function or indexing a variable, use parentheses. otherwise check for mismatched delimiters.

The reason is these two lines: xx1=(0,8.*pi,1000) x3=(-4,4) Did you maybe forget linspace? Anyway, this isn't valid Matlab s...

1 month ago | 0

Answered

why \pi don't work??

Why did you expect it to? This isn't LaTeX. If you want the pi symbol in a character vector that is possible: char(960) Or yo...

why \pi don't work??

Why did you expect it to? This isn't LaTeX. If you want the pi symbol in a character vector that is possible: char(960) Or yo...

1 month ago | 0

Answered

arrays have incompatible sizes for this operation help me PLZ

I have removed all the plotting code and included calls to size to determine the sizes of all the variables involved. data_size...

arrays have incompatible sizes for this operation help me PLZ

I have removed all the plotting code and included calls to size to determine the sizes of all the variables involved. data_size...

2 months ago | 0

| accepted

Answered

How can I load .mat files?

Or: matfilenames={'Datasets/a.mat','Datasets/b.mat','Datasets/c.mat'}; for k = 1:3 S=load(matfilename{k}); fields=fi...

How can I load .mat files?

Or: matfilenames={'Datasets/a.mat','Datasets/b.mat','Datasets/c.mat'}; for k = 1:3 S=load(matfilename{k}); fields=fi...

2 months ago | 1

| accepted

Answered

How to fix "Error using == Arrays have incompatible sizes for this operation." in this code?

Let's have a look at the line that results in an error: n1=(sum(x.*y)-length(d)*mean(x)*mean(y))/(sum(x.^2)-length(d)*(mean(x)*...

How to fix "Error using == Arrays have incompatible sizes for this operation." in this code?

Let's have a look at the line that results in an error: n1=(sum(x.*y)-length(d)*mean(x)*mean(y))/(sum(x.^2)-length(d)*(mean(x)*...

2 months ago | 0

Answered

The Problem with clc; clear; close all; ?

My main point is that people will get into the habit of using this, and will also use it in functions. Clear is almost never ...

The Problem with clc; clear; close all; ?

My main point is that people will get into the habit of using this, and will also use it in functions. Clear is almost never ...

2 months ago | 0

| accepted

Answered

Stop using suggested word on right arrow

I just checked for you: If you go to the preferences (in the 'Home' tab), you can disable the automatic completions in the MATL...

Stop using suggested word on right arrow

I just checked for you: If you go to the preferences (in the 'Home' tab), you can disable the automatic completions in the MATL...

2 months ago | 1

Answered

Unable to use a value of type 'cell' as an index

You need to unwind the call to see what's going on. When you create r_4, you have set UniformOutput to false. That means it i...

Unable to use a value of type 'cell' as an index

You need to unwind the call to see what's going on. When you create r_4, you have set UniformOutput to false. That means it i...

2 months ago | 1

| accepted

Answered

Extracting every row from a matrix using a for loop

This might not be optimal, depending on what you want to do, but the size function is here to help: data=rand(23999,31) for ro...

Extracting every row from a matrix using a for loop

This might not be optimal, depending on what you want to do, but the size function is here to help: data=rand(23999,31) for ro...

2 months ago | 0

Answered

Loop in a string array and changing string

Why didn't you mention this is homework? (I have seen this exact situation from another user this week, so barring evidence to t...

Loop in a string array and changing string

Why didn't you mention this is homework? (I have seen this exact situation from another user this week, so barring evidence to t...

2 months ago | 0

| accepted