## Category: Matlab

### Category Archives: Matlab

## at starting very high current spikes are getting in bidirectional dc dc converter?

when i am simulating at starting the currents spikes are getting.when i am simulating at starting the currents spikes are getting.Read Morebi directional dc dcMATLAB Answers — New Questions

## Plotting log functions in App designer

Hi there,

I am trying to create a radar app from scratch using functions that are tested okay in Matlab, when i run the codes in appdesigner, the graph does not show. Kindly help. Thanks.

Codes are :

tsc = app.TscansEditField.Value;

Tsc = 10*log10(tsc); % convert Tsc into log equiv

sigma_a = app.AircraftRCSdBsmEditField.Value;

sigma_m = app.MissileRCSdBsmEditField.Value;

% four_pi = 10*log10(4.0 * pi); % (4pi) in dB

k_db = 10*log10(1.38e-23); % Boltzman’s constant in dB equiv.

te = app.EffectiveTemperatureKEditField.Value;

Te = 10*log10(te); % noise temp. in dB

% range_a = app.RangeaKmEditField.Value;

% range_adb = 10*log10(range_a* 1000.); % target range^4 in dB

% range_m = app.RangemKmEditField.Value;

% range_mdb = 10*log10(range_m* 1000.); % target range^4 in dB

az_anglea = app.AzimuthangledegEditField.Value;

el_anglea = app.ElevationangledegEditField.Value;

rloss = app.RadarLossdBEditField.Value;

snr = app.SNRdBEditField.Value;

nf = app.NoiseFiguredBEditField.Value;

factor = 10*log10(4*pi);

% Compute Omega in steradians

omega = (az_anglea / 57.296) * (el_anglea /57.296);

omega_db = 10.0*log10(omega); % Convert Omega to dBs

% Plot Power aperture product for missile and aircraft

rangevar = linspace (2,90,1);

rangedb = 10*log10(rangevar);

papm = snr – sigma_m – Tsc + factor + 4.0 .* rangedb + k_db + Te + nf + rloss + omega_db;

papa = snr – sigma_a – Tsc + factor + 4.0 .* rangedb + k_db + Te + nf + rloss + omega_db;

plot(app.UIAxes4,rangevar,papm,"g")

hold (app.UIAxes4, ‘on’ )

plot(app.UIAxes4,rangevar,papa, "r")

hold (app.UIAxes4, ‘off’ )Hi there,

I am trying to create a radar app from scratch using functions that are tested okay in Matlab, when i run the codes in appdesigner, the graph does not show. Kindly help. Thanks.

Codes are :

tsc = app.TscansEditField.Value;

Tsc = 10*log10(tsc); % convert Tsc into log equiv

sigma_a = app.AircraftRCSdBsmEditField.Value;

sigma_m = app.MissileRCSdBsmEditField.Value;

% four_pi = 10*log10(4.0 * pi); % (4pi) in dB

k_db = 10*log10(1.38e-23); % Boltzman’s constant in dB equiv.

te = app.EffectiveTemperatureKEditField.Value;

Te = 10*log10(te); % noise temp. in dB

% range_a = app.RangeaKmEditField.Value;

% range_adb = 10*log10(range_a* 1000.); % target range^4 in dB

% range_m = app.RangemKmEditField.Value;

% range_mdb = 10*log10(range_m* 1000.); % target range^4 in dB

az_anglea = app.AzimuthangledegEditField.Value;

el_anglea = app.ElevationangledegEditField.Value;

rloss = app.RadarLossdBEditField.Value;

snr = app.SNRdBEditField.Value;

nf = app.NoiseFiguredBEditField.Value;

factor = 10*log10(4*pi);

% Compute Omega in steradians

omega = (az_anglea / 57.296) * (el_anglea /57.296);

omega_db = 10.0*log10(omega); % Convert Omega to dBs

% Plot Power aperture product for missile and aircraft

rangevar = linspace (2,90,1);

rangedb = 10*log10(rangevar);

papm = snr – sigma_m – Tsc + factor + 4.0 .* rangedb + k_db + Te + nf + rloss + omega_db;

papa = snr – sigma_a – Tsc + factor + 4.0 .* rangedb + k_db + Te + nf + rloss + omega_db;

plot(app.UIAxes4,rangevar,papm,"g")

hold (app.UIAxes4, ‘on’ )

plot(app.UIAxes4,rangevar,papa, "r")

hold (app.UIAxes4, ‘off’ )Read Moreradar app, plotting functionsMATLAB Answers — New Questions

## Is it possible to modify the detectCheckerBoard-function to detect all edge points?

Hello,

I want to detect all edge points on a Checkerboard, which is not rectangular. I am using the Funktion: detectCheckerboardPoints

I need this to calculate the distortion on an Area.

Thanks for your answers!Hello,

I want to detect all edge points on a Checkerboard, which is not rectangular. I am using the Funktion: detectCheckerboardPoints

I need this to calculate the distortion on an Area.

Thanks for your answers!Read Moreimage processing, detectcheckerboardpointsMATLAB Answers — New Questions

## How to design and export a Hilbert transform

I am trying to design a Hilbert transform that will be implemented on an FPGA. The hilbert() matlab function does not return coefficients.

I tried to design the transfom with filterDesigner and exported the coefficients to a variable named Num. This call return non-complex data

dataHilbert= filter(Num, 1, data);

Designing the filter with fdesign.hilbert() also returns non-complex values:

d = fdesign.hilbert();

Hd = design(d,’firls’);

dataHilbert = filter(Hd,data);

How do I get these transforms to return correct complex data?I am trying to design a Hilbert transform that will be implemented on an FPGA. The hilbert() matlab function does not return coefficients.

I tried to design the transfom with filterDesigner and exported the coefficients to a variable named Num. This call return non-complex data

dataHilbert= filter(Num, 1, data);

Designing the filter with fdesign.hilbert() also returns non-complex values:

d = fdesign.hilbert();

Hd = design(d,’firls’);

dataHilbert = filter(Hd,data);

How do I get these transforms to return correct complex data?Read Morefilter, hilbertMATLAB Answers — New Questions

## 【求助】关于MATLAB热力图heatmap。

主要问题有以下三个：环境：win10 MATLAB 2014a和MATLAB 2016a均尝试有以下问题。

一、大小写问题

Help文件和网上的例子中，均采用heatmap即可调用热力图函数，但我在尝试的时候会提示错误，必须使用首字母大写的函数，如下图。

二、figure问题

热力图好像不能放到figure里面调用，会出现一个空的figure和一个heatmap。比如代码：

figure(1)

HeatMap(valueset);

三、热力图问题

产生的热力图有三个问题，一个是好像只有红色和绿色两个颜色，二是右侧colorbar上下限不能修改，三是数据精度发生改变，代码和结果如下：

valueset = [2.989 2.976 2.921 2.877;3.010 2.999 3.121 3.087;2.988 2.991 3.056 3.046;2.976 3.015 2.865 3.078];

figure(1)

HeatMap(valueset)；

恳请各位老师能够指教。不胜感激。主要问题有以下三个：环境：win10 MATLAB 2014a和MATLAB 2016a均尝试有以下问题。

一、大小写问题

Help文件和网上的例子中，均采用heatmap即可调用热力图函数，但我在尝试的时候会提示错误，必须使用首字母大写的函数，如下图。

二、figure问题

热力图好像不能放到figure里面调用，会出现一个空的figure和一个heatmap。比如代码：

figure(1)

HeatMap(valueset);

三、热力图问题

产生的热力图有三个问题，一个是好像只有红色和绿色两个颜色，二是右侧colorbar上下限不能修改，三是数据精度发生改变，代码和结果如下：

valueset = [2.989 2.976 2.921 2.877;3.010 2.999 3.121 3.087;2.988 2.991 3.056 3.046;2.976 3.015 2.865 3.078];

figure(1)

HeatMap(valueset)；

恳请各位老师能够指教。不胜感激。Read More热力图, heatmapMATLAB Answers — New Questions

## What is Symbolic Math Toolbox and how to get it

Hello

New to MatLAB and got an error stating that I need to install something called ‘Symbolic Math Toolbox’.

Wondered if anyone could elaborate on what it is, why is it important and how to get it.

CheersHello

New to MatLAB and got an error stating that I need to install something called ‘Symbolic Math Toolbox’.

Wondered if anyone could elaborate on what it is, why is it important and how to get it.

CheersRead Morematlab, symbolicMATLAB Answers — New Questions

## Generate Random Number, that is that is repeatable

Hi,

I have generated a code in order to replace the entire original column, with random repeated value but it doesnt give the desired output

% Code is

if range(Selected_Data1(:,1)) ==0

for Iter=1:length(Selected_Data1)

rng(1);

P_MMSI(Iter) = rand(1);

end

end

The above code always replace the value 209026000 with 0.417022004702574, nevertheless, I am expecting the random output vector would be 9 interger numbers (e.g., 781234012)

For example, if the original column is

209026000

209026000

209026000

209026000

209026000

209026000

209026000

209026000

209026000

209026000

% The expected output would be something

781234012

781234012

781234012

781234012

781234012

781234012

781234012

781234012

781234012Hi,

I have generated a code in order to replace the entire original column, with random repeated value but it doesnt give the desired output

% Code is

if range(Selected_Data1(:,1)) ==0

for Iter=1:length(Selected_Data1)

rng(1);

P_MMSI(Iter) = rand(1);

end

end

The above code always replace the value 209026000 with 0.417022004702574, nevertheless, I am expecting the random output vector would be 9 interger numbers (e.g., 781234012)

For example, if the original column is

209026000

209026000

209026000

209026000

209026000

209026000

209026000

209026000

209026000

209026000

% The expected output would be something

781234012

781234012

781234012

781234012

781234012

781234012

781234012

781234012

781234012Read Morerandom number generatorMATLAB Answers — New Questions

## Select zone of the plot

Hey guys, thanks in advance,

Is there a way of representing azimuth3, only the red zones, which means, selecting only the most red zones of the plot?Hey guys, thanks in advance,

Is there a way of representing azimuth3, only the red zones, which means, selecting only the most red zones of the plot?Read MoreplotMATLAB Answers — New Questions

## Understanding the conditional output beginning with (t == 0 | v == 0)

Upon integrating a time dependent variable, an exerpt to my solution contains the following: (t == 0 | v == 0) & m ~= n & m + n ~= 0 & 0<= v*t, the solution… I seem to understand every other thing except for this (t == 0 | v == 0). I need an explanation to (t == 0 | v == 0) please. Thank you.Upon integrating a time dependent variable, an exerpt to my solution contains the following: (t == 0 | v == 0) & m ~= n & m + n ~= 0 & 0<= v*t, the solution… I seem to understand every other thing except for this (t == 0 | v == 0). I need an explanation to (t == 0 | v == 0) please. Thank you.Read Moreconditional output, impulse function integralMATLAB Answers — New Questions

## matlab循环 正忙。

在matlab里面输入下面的代码 一直显示正忙 是不是陷入了死循环 大神们能帮忙看一下么

v=[15 16 17 18 19];

f=[76 79 83 88 93];

for i=1:1:5

for a=0.1:0.1:1

for b=0.1:0.1:1

while a+b==1

vc=a*v(i)+b*v(i+1);

end

end

end

end

F=interp1(v,f,vc,’linear’);在matlab里面输入下面的代码 一直显示正忙 是不是陷入了死循环 大神们能帮忙看一下么

v=[15 16 17 18 19];

f=[76 79 83 88 93];

for i=1:1:5

for a=0.1:0.1:1

for b=0.1:0.1:1

while a+b==1

vc=a*v(i)+b*v(i+1);

end

end

end

end

F=interp1(v,f,vc,’linear’);Read Morematlab, 循环MATLAB Answers — New Questions

## How to export a file “focal_mech_stress.csv” in Coulomb 3.3

After I import the existing input file, I click overlays–>earthquakes to import earthquake data. However, the format data required by the [focal_mech_calc.m] file was not found in the case earthquake data–>[% 1) lon, 2) lat, 3) year, 4) month, 5) day, 6) m, 7) depth, 8) hr, 9) min, 10) strike1, 11) DIP1, 12) rake1, 13) strike2, 14) dip2, 15) rake2, 16) x position, 17) y position]. When I import the earthquake data in the earthquake_data file, after running funtions–>Calc stress on faults, only the [element_conditions.csv] file is generated, and [focal_mech_stress.csv] is not generated. What is the reason?

When I write earthquake data in the file format of [focal_mech_calc.m], when I click overlays–>earthquakes, I cannot import it successfully. What is the reason?

Can anyone answer this question? Thank you very muchAfter I import the existing input file, I click overlays–>earthquakes to import earthquake data. However, the format data required by the [focal_mech_calc.m] file was not found in the case earthquake data–>[% 1) lon, 2) lat, 3) year, 4) month, 5) day, 6) m, 7) depth, 8) hr, 9) min, 10) strike1, 11) DIP1, 12) rake1, 13) strike2, 14) dip2, 15) rake2, 16) x position, 17) y position]. When I import the earthquake data in the earthquake_data file, after running funtions–>Calc stress on faults, only the [element_conditions.csv] file is generated, and [focal_mech_stress.csv] is not generated. What is the reason?

When I write earthquake data in the file format of [focal_mech_calc.m], when I click overlays–>earthquakes, I cannot import it successfully. What is the reason?

Can anyone answer this question? Thank you very muchRead Morecoulomb 3.3MATLAB Answers — New Questions

## Optimization of the weighted average sum of matrix norms in the workspace using the Optimization Tool

There are workspace from three 3×3 matrices with random elements:

A=rand(3,3);

B=rand(3,3);

C=rand(3,3);

There are 9 vectors of the following form:

u1=[cos(a);sin(a);1-cos(0)]

u2=[cos(a);sin(a);1-cos(2*pi/3)]

u3=[cos(a);sin(a);1-cos(-2*pi/3)]

v1=[sin(b)*cos(C);sin(a);-cos(0)-1]

v2=[sin(b)*cos(C);sin(a);-cos(2*pi/3)-1]

v3=[sin(b)*cos(C);sin(a);-cos(-2*pi/3)-1]

w1=[cos(A);sin(B);-sin(0)]

w2=[cos(A);sin(B);-sin(2*pi/3)]

w3=[cos(A);sin(B);-sin(-2*pi/3)]

here – variables;

The matrix of the following form is formed from the vectors:

J=[cross(v1,w1)/dot(cross(u1,v1),w1) cross(v2,w2)/dot(cross(u2,v2),w2) cross(v3,w3)/dot(cross(u3,v3),w3)];

Problem: We need to find parameters that minimize the weighted average sum of matrix norms at each of the workspace points, i.e.:

How to solve this problem using Optimization Tool ?There are workspace from three 3×3 matrices with random elements:

A=rand(3,3);

B=rand(3,3);

C=rand(3,3);

There are 9 vectors of the following form:

u1=[cos(a);sin(a);1-cos(0)]

u2=[cos(a);sin(a);1-cos(2*pi/3)]

u3=[cos(a);sin(a);1-cos(-2*pi/3)]

v1=[sin(b)*cos(C);sin(a);-cos(0)-1]

v2=[sin(b)*cos(C);sin(a);-cos(2*pi/3)-1]

v3=[sin(b)*cos(C);sin(a);-cos(-2*pi/3)-1]

w1=[cos(A);sin(B);-sin(0)]

w2=[cos(A);sin(B);-sin(2*pi/3)]

w3=[cos(A);sin(B);-sin(-2*pi/3)]

here – variables;

The matrix of the following form is formed from the vectors:

J=[cross(v1,w1)/dot(cross(u1,v1),w1) cross(v2,w2)/dot(cross(u2,v2),w2) cross(v3,w3)/dot(cross(u3,v3),w3)];

Problem: We need to find parameters that minimize the weighted average sum of matrix norms at each of the workspace points, i.e.:

How to solve this problem using Optimization Tool ?Read Moreoptimization, matrix, vectors, toolboxMATLAB Answers — New Questions

## Save matrix as a spreadsheet image (in previous versions)

A couple of weeks ago, I asked how one could export a table to an image of the table, linked here,

https://www.mathworks.com/matlabcentral/answers/1759050-save-matrix-as-a-spreadsheet-image

That solution worked for me, but the client’s version of MATLAB is R2016b. The tool used in this answer was exportapp, which was introduced in R2020b. Is there an alternative that is compatible with previous versions?

Thanks!A couple of weeks ago, I asked how one could export a table to an image of the table, linked here,

https://www.mathworks.com/matlabcentral/answers/1759050-save-matrix-as-a-spreadsheet-image

That solution worked for me, but the client’s version of MATLAB is R2016b. The tool used in this answer was exportapp, which was introduced in R2020b. Is there an alternative that is compatible with previous versions?

Thanks!Read Morematrix, spreadsheet, image, oldversion, previous versionMATLAB Answers — New Questions

## fprintf for ~million row string matrix

Hi,

I’m trying to write data to csv files, but using fprintf (or the way I am using it) seems to be extremely slow

The data is formatted in columns containing fields such as: {ID (string), date (string), numeric data, flag (string), …}.

I get the data as a cell array, with each cell having a column of data.

What I’ve done is cast everything into a string and take the transpose of the data (it seems MATLAB does things in a column-major order).

Also note I’ve added a bunch of commas without data inbetween. That’s the expected format of the data, so that has to stay.

fid = fopen(fullfile(output, replace(file.name, ‘.dat’, ‘.csv’)), ‘w’);

fprintf(fid, [repmat(‘%s,’, 1, nCols), repmat(‘,’, 1, 86-nCols), ‘n’], T);

fclose(fid);

It looks as if saving a single file takes several minutes (haven’t managed to save even one file yet – and I need to do this for 365 files).

Is there a way to speed up this process?

Kind Regards,

ErikHi,

I’m trying to write data to csv files, but using fprintf (or the way I am using it) seems to be extremely slow

The data is formatted in columns containing fields such as: {ID (string), date (string), numeric data, flag (string), …}.

I get the data as a cell array, with each cell having a column of data.

What I’ve done is cast everything into a string and take the transpose of the data (it seems MATLAB does things in a column-major order).

Also note I’ve added a bunch of commas without data inbetween. That’s the expected format of the data, so that has to stay.

fid = fopen(fullfile(output, replace(file.name, ‘.dat’, ‘.csv’)), ‘w’);

fprintf(fid, [repmat(‘%s,’, 1, nCols), repmat(‘,’, 1, 86-nCols), ‘n’], T);

fclose(fid);

It looks as if saving a single file takes several minutes (haven’t managed to save even one file yet – and I need to do this for 365 files).

Is there a way to speed up this process?

Kind Regards,

ErikRead Morefprintf, write data, performanceMATLAB Answers — New Questions

## Plot electric field in plane

Good afternoon,

the png file shows the magnitude of an electric field in a plane, which was calculated by means of an electromagnetic field solver. I exported the field data to a txt file (see attachement), as I want to plot these data in Matlab. How can I create a plot, whose result looks similar to the attached png file?

Thank you very much for your help!Good afternoon,

the png file shows the magnitude of an electric field in a plane, which was calculated by means of an electromagnetic field solver. I exported the field data to a txt file (see attachement), as I want to plot these data in Matlab. How can I create a plot, whose result looks similar to the attached png file?

Thank you very much for your help!Read MoreplotMATLAB Answers — New Questions

## Make a continuous line from an edge

Hello all,

I am trying to extract the edge from a picture. However the resulting edge is disconnected and I do not know how to each single segment I have, making a continuous line. I am usign the following code:

image=load(‘imagePLIF.mat’);

image=image.image;

imageB=image(:,170:1232);

BW = medfilt2(imageB,[5,5]);

BW = mat2gray(BW);

imagesc(BW)

BWmean = rescale(BW);

PLIF_gaussfilt = imguidedfilter(imgaussfilt(BWmean));

PLIF_sharpen = imsharpen(PLIF_gaussfilt, ‘Radius’, 1, ‘Amount’, 1);

PLIF_sharpen(PLIF_sharpen > .12) = 1;

PLIF_edge = edge(PLIF_sharpen, ‘Sobel’);

figure()

imagesc(PLIF_edge)Hello all,

I am trying to extract the edge from a picture. However the resulting edge is disconnected and I do not know how to each single segment I have, making a continuous line. I am usign the following code:

image=load(‘imagePLIF.mat’);

image=image.image;

imageB=image(:,170:1232);

BW = medfilt2(imageB,[5,5]);

BW = mat2gray(BW);

imagesc(BW)

BWmean = rescale(BW);

PLIF_gaussfilt = imguidedfilter(imgaussfilt(BWmean));

PLIF_sharpen = imsharpen(PLIF_gaussfilt, ‘Radius’, 1, ‘Amount’, 1);

PLIF_sharpen(PLIF_sharpen > .12) = 1;

PLIF_edge = edge(PLIF_sharpen, ‘Sobel’);

figure()

imagesc(PLIF_edge)Read Moreimage processing, image, edgeMATLAB Answers — New Questions

## rptview() error – timing out

I am suddenly getting an error trying to use rptview() where I haven’t gotten one before, without changing anything. I am getting the following error codes:

Error using mlreportgen.utils.internal/executeRPC

Retry calling function "@()openDocNETObj(hDocs,fullFilePath)".

Error in mlreportgen.utils.WordDoc/createNETObj

Error in mlreportgen.utils.internal/OfficeDoc

Error in mlreportgen.utils.WordDoc

Error in mlreportgen.utils.internal/WordController/createDoc

Error in mlreportgen.utils.internal/OfficeController/load

Error in mlreportgen.utils.word.load

Error in mlreportgen.utils.rptviewer/createViewer

Error in mlreportgen.utils.rptviewer.viewer

Error in mlreportgen.utils.internal/rptview

Error in rptview (line 65)

mlreportgen.utils.internal.rptview(fileName, varargin{:})

Error in generate_POTT_report (line 179)

rptview(D);

Caused by:

Error using mlreportgen.utils.WordDoc

Timed out while waiting for "<redacted>Report.docx" to open.

Any ideas? The code was working fine till this morning.

My code is generating a report and then opens it automatically for review. I have double and triple checked to make sure the filepath is correct. The file is being created and is located where it says it should be.I am suddenly getting an error trying to use rptview() where I haven’t gotten one before, without changing anything. I am getting the following error codes:

Error using mlreportgen.utils.internal/executeRPC

Retry calling function "@()openDocNETObj(hDocs,fullFilePath)".

Error in mlreportgen.utils.WordDoc/createNETObj

Error in mlreportgen.utils.internal/OfficeDoc

Error in mlreportgen.utils.WordDoc

Error in mlreportgen.utils.internal/WordController/createDoc

Error in mlreportgen.utils.internal/OfficeController/load

Error in mlreportgen.utils.word.load

Error in mlreportgen.utils.rptviewer/createViewer

Error in mlreportgen.utils.rptviewer.viewer

Error in mlreportgen.utils.internal/rptview

Error in rptview (line 65)

mlreportgen.utils.internal.rptview(fileName, varargin{:})

Error in generate_POTT_report (line 179)

rptview(D);

Caused by:

Error using mlreportgen.utils.WordDoc

Timed out while waiting for "<redacted>Report.docx" to open.

Any ideas? The code was working fine till this morning.

My code is generating a report and then opens it automatically for review. I have double and triple checked to make sure the filepath is correct. The file is being created and is located where it says it should be.Read Morerptview(), mlreportgen.dom.*, mlreportgen.report.*, d=document()MATLAB Answers — New Questions

## How do i get the [num den] from the filter design coefficients ?

I used matlab filter design tool to design a linear phase IIR filter, code as below

Fs = 32e3; % Sampling frequency: 9.6 kHz

TW = 1500; % Transition width

Ast = 90; % Minimum stopband attenuation: 80 dB

M = 4; % Decimation factor

NyquistDecimDesign = fdesign.decimator(M,’Nyquist’,M,TW,Ast,Fs);

IIRLinearPhaseFilt = design(NyquistDecimDesign,’multistage’, ‘HalfbandDesignMethod’,’iirlinphase’,’SystemObject’,true);

freqz(IIRLinearPhaseFilt.Stage2)

there are the two stages polyphase filter Coefficients in IIRLinearPhaseFilt.Coeefficients, but how can i get the coeffcients to [num, den] style?

because i need to use these Coefficients to design a embedded filter.

i refered from Decimate by factor of two using polyphase IIR – MATLAB (mathworks.com)

but i dont understand whats the a b c in Cofficients, the Cofficients is a matrix such as 6×2 size.

I need some help. Thank you very very much!I used matlab filter design tool to design a linear phase IIR filter, code as below

Fs = 32e3; % Sampling frequency: 9.6 kHz

TW = 1500; % Transition width

Ast = 90; % Minimum stopband attenuation: 80 dB

M = 4; % Decimation factor

NyquistDecimDesign = fdesign.decimator(M,’Nyquist’,M,TW,Ast,Fs);

IIRLinearPhaseFilt = design(NyquistDecimDesign,’multistage’, ‘HalfbandDesignMethod’,’iirlinphase’,’SystemObject’,true);

freqz(IIRLinearPhaseFilt.Stage2)

there are the two stages polyphase filter Coefficients in IIRLinearPhaseFilt.Coeefficients, but how can i get the coeffcients to [num, den] style?

because i need to use these Coefficients to design a embedded filter.

i refered from Decimate by factor of two using polyphase IIR – MATLAB (mathworks.com)

but i dont understand whats the a b c in Cofficients, the Cofficients is a matrix such as 6×2 size.

I need some help. Thank you very very much!Read Morefilter design, fiter coefficients, dspMATLAB Answers — New Questions

## Bug in Simulink onramo

While running simulink onramp at the step “identifyng Bloks and Signals” task 2 appears a “bockModule” test is not related to the exercise that in fact running gives error that not allow go further with the tutorial. Everyone know how to overcome the problem ?While running simulink onramp at the step “identifyng Bloks and Signals” task 2 appears a “bockModule” test is not related to the exercise that in fact running gives error that not allow go further with the tutorial. Everyone know how to overcome the problem ?Read Moresimulink, onrsmp, wrongmodule, “blockmodule”MATLAB Answers — New Questions

## Is it possible to (non-linear) minimize x^y by choosing both x and y?

Hi there,

While working on a non-linear optimization problem with Matlab, I encountered errors that I cannot debug by myself, and I even doubt if Matlab can solve this optimization… I have the following code:

%%%%%%%%%%%%%%%%%%%%%%%%CODE BELOW

x = optimvar(‘x’);

y = optimvar(‘y’);

prob = optimproblem( "Objective", x ^ (sqrt(y)));

prob.Constraints.con1 = x >=1.01;

prob.Constraints.con2 = y >=1.01;

prob.Constraints.con3 = y <=2;

prob.Constraints.con4 = x ^ y >=100;

prob.Constraints.con4 = x <= 100;

x0.x = 1.01;

x0.y = 1.01;

sol = solve(prob,x0)

%%%%%%%%%%%%%%%%%%%%%%%%%%CODE END

Meanwhile, the error message is as follows:

%%%%%%

"Error using optim.internal.problemdef.operator.PowerOperator

Exponent must be a finite real numeric scalar.

Error in optim.internal.problemdef.Power

Error in .^

Error in ^

Error in optimization_solver (line 4)

prob = optimproblem( "Objective", x ^ (sqrt(y)));"

%%%%%%

Sincere appreciations to everyone modifying my codes to get the problem solved, or providing any answers.Hi there,

While working on a non-linear optimization problem with Matlab, I encountered errors that I cannot debug by myself, and I even doubt if Matlab can solve this optimization… I have the following code:

%%%%%%%%%%%%%%%%%%%%%%%%CODE BELOW

x = optimvar(‘x’);

y = optimvar(‘y’);

prob = optimproblem( "Objective", x ^ (sqrt(y)));

prob.Constraints.con1 = x >=1.01;

prob.Constraints.con2 = y >=1.01;

prob.Constraints.con3 = y <=2;

prob.Constraints.con4 = x ^ y >=100;

prob.Constraints.con4 = x <= 100;

x0.x = 1.01;

x0.y = 1.01;

sol = solve(prob,x0)

%%%%%%%%%%%%%%%%%%%%%%%%%%CODE END

Meanwhile, the error message is as follows:

%%%%%%

"Error using optim.internal.problemdef.operator.PowerOperator

Exponent must be a finite real numeric scalar.

Error in optim.internal.problemdef.Power

Error in .^

Error in ^

Error in optimization_solver (line 4)

prob = optimproblem( "Objective", x ^ (sqrt(y)));"

%%%%%%

Sincere appreciations to everyone modifying my codes to get the problem solved, or providing any answers.Read Moreoptimization, nonlinearMATLAB Answers — New Questions