https://it.mathworks.com/matlabcentral/answers/questionsMATLAB Answers — New Questions2019-11-18T14:59:56Ztag:it.mathworks.com,2005:Question/4913982019-11-16T06:25:09Z2019-11-18T14:59:56Zhow to contaminate ecg signal with noiseI am working on the project namely "FALSE ALARM REDUCTION IN ATRIAL FIBRILLATION DETCTION USING DEEP BELIEF NETWORKS".
In this i need to download two databases, namely 07910m.mat{MIT_BIH ATRIAL FIBRILLATION DATABASE} which is attached here,and also the 'em' recording {MIT_BIH NOISE STRESS TEST DATABASE} is attached.
The afib database has Fs=250Hz and 10h in length,and 'em' recording is 30 min and has Fs=360Hz
now i need to make the 'em' recording 10h in length
in the paper its told that i can be done using auto regressive model,iam not knowing how to do it
can anyone suggest me the coding for this
sai lakshmihttps://it.mathworks.com/matlabcentral/profile/authors/15911919-sai-lakshmitag:it.mathworks.com,2005:Question/4915002019-11-17T01:55:18Z2019-11-18T14:57:36ZHow to arrange time series data into yearly groups?Hi,
I have daily temperature time series from 01/03/1961 to 28/07/2018. I want to arrange this data as per water year convention (01 June to 31 May) in following form:
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Temperature Temperature Temperature
Date (1960-1961) Date (1961-1962) . . . . . . . . . . . (2017-2018)
01/06/1960 01/06/1961
. .
. .
. .
. .
. .
31/05/1961 31/05/1962
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Finally, I need this data table in following form
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
= = = = = = = = = = = = Temperature = = = = = = = = = = = =
Day 1960-1961 1961-1962 . . . . . . . 2017-2018
1
2
3
.
.
.
.
.
.
365
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Please tell me how to do this.
Thanks in advance.Parthu Phttps://it.mathworks.com/matlabcentral/profile/authors/16698457-parthu-ptag:it.mathworks.com,2005:Question/4917172019-11-18T14:48:44Z2019-11-18T14:56:21ZHow can i solve this problem?The problem: a traveling salesman wants to visit all cities of a given together, and route distances between the various cities are known. Consider now the problem, starting and ending in a given city, determining the route to be taken by the traveling salesman who, once passing through the remaining cities, minimizes the total distance to be traveled. This problem will be developed using the neighbor's heuristic closest to go by choosing how next city to visit that that, among the cities not yet visited, is closest to the city where you are. This heuristic can be used in the traveling salesman problem. last city visited to the city of origin. The project consists of developing a menu application that allows the any user to use the resolution of this problem.
One of the menu options is' Show Affections' and for that we have to perform a function called 'prints? to show in the command window the allocations with their costs and the total cost. What is shown should respect this format:
Carolina Silvahttps://it.mathworks.com/matlabcentral/profile/authors/15483439-carolina-silvatag:it.mathworks.com,2005:Question/4917162019-11-18T14:47:22Z2019-11-18T14:55:25ZUsing find command to find bifurcation pointsI have code which plots a graph showing the levels of Notch and Delta in a pair of cells. The graph is a bifurcation diagram with 2 bifurcation points. After plotting, I have attempted to find the 2 values of 'a' where the bifurcations happen. I have tried using the find command but only receive empty vectors when I run the code.
% Specify initial conditions
dinit=[0 1];
ninit=[1 0];
initialconditions=[dinit; ninit]';
% Set values of a
a=logspace(-8,2,200);
for i=1:numel(a)
% Apply ode45
[t,y]=ode45(@(t,y)twocellfunct(t,y,a(i)),[0 200],initialconditions);
% Calculate maximum value of Notch in cells 1 and 2
mx=max([y(end,3), y(end,4)]);
% Calculate minimum value of Notch in cells 1 and 2
mn=min([y(end,3), y(end,4)]);
% Storing the max/min values of notch for each a
M(:,i)=[mx mn]';
end
% Plot
semilogx(a,M(1,:),'r');
hold on
semilogx(a,M(2,:),'b');
xlabel('a');
ylabel('notch level');
y=ylabel('notch level', 'rot', 90);
set(y, 'Units', 'Normalized', 'Position', [-0.07, 0.5, 0]);
a1=find(abs(M(1,:)-M(2,:))<eps,1,'first');
a2=find(abs(M(1,:)-M(2,:))<eps,1,'last');Ross Mannionhttps://it.mathworks.com/matlabcentral/profile/authors/8914571-ross-manniontag:it.mathworks.com,2005:Question/3176762016-12-21T06:43:50Z2019-11-18T14:54:36ZUigetfile will make app be behind another windows.I use APP Designer to make a App figure.
I want to load my file and display its name，so I use uigetfile.
But used uigetfile will make my figure be behind another windows, I have to click it in Taskbar again.
Why is this so?Shao-Qi Leihttps://it.mathworks.com/matlabcentral/profile/authors/7425591-shao-qi-leitag:it.mathworks.com,2005:Question/4913732019-11-15T22:52:06Z2019-11-18T14:54:32ZChange plot properties generated from a curve fittingHello,
I am trying to remove the markers and change the line properties from a plot made by rational fit. I tried different options such as Marker, none and Linestyle but it did not work. I have event tried h.Marker='none' and no success. Any idea how to solve this?
[fitresult, gof] = fit( xData, yData, ft, opts );
% h = plot( fitresult, xData, yData, 'Linestyle', 'none','Color','k', 'Marker',marker_style{i} );
h = plot( fitresult, xData, yData);
h.Marker = 'none';
ThanksReza Sabbaghhttps://it.mathworks.com/matlabcentral/profile/authors/7366145-reza-sabbaghtag:it.mathworks.com,2005:Question/4630932019-05-20T13:15:23Z2019-11-18T14:48:37ZGet signal name at inport of subsystemHi,
I would like a subsystem to know the name of its input so that it can be used for a custom logging solution. I expect a callback on the subsystem which defines a variable could be one way to realize it. I just can't figure out how the callback should obtain the name.
Here is an illustration from the top level:
And how I would get the value from the callback.
Do you have any ideas how the callback would look?
Jes Jensenhttps://it.mathworks.com/matlabcentral/profile/authors/5539128-jes-jensentag:it.mathworks.com,2005:Question/3028102016-09-12T18:23:19Z2019-11-18T14:47:46ZException MWArray assembly failed to be initializedI have a .Net DLL created from Matlab Compiler SDK. I created a simple .Net application around it to test proper input and output. This application works as expected. When I try to integrate the library using the same wrapper class into a larger application, I get the following exception:
{"MWArray assembly failed to be initialized"}
{"StartIndex cannot be less than zero.\r\nParameter name: startIndex"}
at Render..ctor()
at Display_Software.Render..cctor() in C:\Users\user\Documents\display\Display Software\Render.cs:line 81
The type initializer for 'Display_Software.Render' threw an exception.
The simple application works fine in console or window mode and with .Net 4.5.2 or 4.6.1. Both apps are referencing the same MWArray.dll.
Any ideas what could be different between the two projects to cause this error?
Zac Drakehttps://it.mathworks.com/matlabcentral/profile/authors/8497241-zac-draketag:it.mathworks.com,2005:Question/4916032019-11-17T23:22:34Z2019-11-18T14:45:08ZCompare two arrays (intersection) and create new array with output columns, but with repetitionsHi,
I have following example arrays, and I want to write the values of the second array to a new array if the values of the first column intersect.
A = [1 3500; 2 100; 2 564; 3 2140; 3 9820; 2 8952]
B = [1 0 0 0.5; 2 0 0 0.8; 3 0 1 0; 4 0 1 0.5; 5 1 1 0; 6 1 1 0.5]
The output should look like this:
C = [0 0 0.5; 0 0 0.8; 0 0 0.8; 0 1 0; 0 1 0; 0 0 0.8]
I tried to use intersect, but it only returns with no repetition, ismember only returns logical and the position is irrelevant for me. And my workaround code does not rly give me what i like to have:
[~, rowsA, rowsB] = intersect(A(:, 1), B(:, 1));
C = [B(rowsB 2) B(rowsB, 3) B(rowsB, 4)];
% Code with ismember (workaround try)
v = intersect(B(:,1),A(:,1));
bmin = ismember(B(:,1),v(:,1));
bmax = ismember(A:,1),v(:,1));
imin = find(bmin);
imax = find(bmax);
S = B(imin);
T = A(imax);
Is there any workaround that I can use to create this output array?
Daniel Rohrerhttps://it.mathworks.com/matlabcentral/profile/authors/14349906-daniel-rohrertag:it.mathworks.com,2005:Question/4917152019-11-18T05:00:00Z2019-11-18T14:43:11ZHow do I make Greek characters and regular text have same font weight in Tex markup?I am using "text" to label points on a plot. The label has a mix of Greek characters and regular text, but the Greek characters appear slightly _lighter_ than the other text. How do I make all of the label appear to have the same font weight?
MathWorks Support Teamhttps://it.mathworks.com/matlabcentral/profile/authors/4622813-mathworks-support-teamtag:it.mathworks.com,2005:Question/4916832019-11-18T11:53:49Z2019-11-18T14:41:39ZHave data in subfolders availableI have a folder with a MATLAB script. In that folder, I have subfolders with information that can be processed with the MATLAB script. If I want to read a specific file, the only idea I have now is to specify the complete path for each file, with it is tedious.
What I would like is to have all those files available, in the same way that you have available all the data when you are working in the current folder. Is there any way to have available all the data in the subfolders (CSV files, TXT files, etc.)?Neko Benítezhttps://it.mathworks.com/matlabcentral/profile/authors/16473505-neko-beniteztag:it.mathworks.com,2005:Question/4916662019-11-18T10:02:49Z2019-11-18T14:37:49Z2D Matrix revolutionHi community
How can I revolutionize a 2D matrix around an axis to obtain a solid?
Supose a NxN matrix. In each row are the points of a kind of gaussian curve with less amplitude and higher width. Plotting this surface shows something like a half bell that decays to zero. (See Bottom)
I want to obtain a 3D image revolutionazing that matrix, so the solid looks like a complete bell, or a mexican hat.
Notice that each curve in the matrix rows are different.
I have already try with cylinder(), but i can't define the rotation axis, and the result is a segmented solid.
Possible solutions so I can get the 3D image and define the rotation axis?
Thanks a lot
The surface to revolutioniye looks like this:
Cylinder shows this:
Felipe Bayonahttps://it.mathworks.com/matlabcentral/profile/authors/15577547-felipe-bayonatag:it.mathworks.com,2005:Question/4905172019-11-11T20:53:01Z2019-11-18T14:36:13ZHow can I write a multi-band image in jp2 format?I would like to compress a multi-band image with JPEG-2000 compression. I tried the following lines but got an error, "4 channels not supported for JP2 files. Only 1 and 3 channels are supported."
test = zeros(10,10,4,'uint8'); imwrite(test,'test.jp2');
Is there a workaround for this problem? JPEG-2000 compresses each band individually so I don't understand the limitation.Thomas Flickhttps://it.mathworks.com/matlabcentral/profile/authors/3823214-thomas-flicktag:it.mathworks.com,2005:Question/668142013-03-12T08:14:33Z2019-11-18T14:35:17ZFor loops vs. While loopsI know the two loops are used differently, although they could be used for the same purpose. However, how would you generally know which one to use, especially in cases where one over the other would be valid?Joehttps://it.mathworks.com/matlabcentral/profile/authors/4095946-joetag:it.mathworks.com,2005:Question/4916932019-11-18T12:59:15Z2019-11-18T14:32:06ZHow can I show this text in the command window?Carolina Silvahttps://it.mathworks.com/matlabcentral/profile/authors/15483439-carolina-silvatag:it.mathworks.com,2005:Question/4914862019-11-16T23:01:19Z2019-11-18T14:32:05Zmqtt via ESP8266 connected but not subscribingHello,
yesterday: i changed the way i collect data from my thinspeak channel from the ThingSpeak arduino library to mqtt. it worked like a charm.
today: my ESP8266 tells me that he is connected. but no data comes from the subscription and so the esp8266 will try to reconnect.
Is there a problem with your Server, or is it an license problem?
I think i reached the maximum of mqtt clients (3 clients in free mode). Is there a way to reset the clients to reconnect?
Best regards
Christian
my test code:
#include <EEPROM.h>
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
#include <Wire.h>
const char ssid[] = "xxxxxxx"; //Insert your SSID
const char pass [] = "xxxxxxxxx"; /Insert Your password
const char* mqtt_server = "mqtt.thingspeak.com";
const char* mqttUserName = "xxxxxxxxxxx"; // Thingspeak username.
const char* mqttPass = "xxxxxxxxxxxxxxxx"; // Change to your MQTT API Key from Account > MyProfile.
const char* ChannelID = "xxxxxx"; // Thingspeak Channel ID
const char* APIKey = "xxxxxxxxxxxxxxxx"; // Thingspeak Channel Read API Key
String Temp_String;
WiFiClient espClient;
PubSubClient client(espClient);
const byte ledPin = 0; // Pin with LED on Adafruit Huzzah
void callback(char* topic, byte* payload, unsigned int length) {
Serial.print("Data received: ");
Serial.print("Temperature ");
for (int i = 0; i < length; i++) {
char receivedChar = (char)payload[i];
Temp_String += (char)payload[i];
}
float TS_Temp = Temp_String.toFloat();
Serial.print(TS_Temp);
TS_Temp = 0;
Temp_String = "";
Serial.println();
}
void reconnect() {
// Loop until we're reconnected
while (!client.connected()) {
Serial.print("Attempting MQTT connection...");
// Attempt to connect
if (client.connect("ESP8266", mqttUserName, mqttPass)) {
Serial.println("connected");
// ... and subscribe to topic
client.subscribe("channels/INSERT YOUR CHANNEL ID HERE/subscribe/fields/field1/INSERT YOUR API READ KEY HERE");
} else {
Serial.print("failed, rc=");
Serial.print(client.state());
Serial.println(" try again in 5 seconds");
// Wait 5 seconds before retrying
delay(5000);
}
}
}
void setup()
{
Serial.begin(115200);
delay(250);
client.setServer(mqtt_server, 1883);
client.setCallback(callback);
WiFi.disconnect();
delay(100);
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, pass);
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(500);
}
Serial.print("OK");
Serial.println();
}
void loop()
{
if (!client.connected()) {
reconnect();
}
client.loop();
}
Christian Seniukhttps://it.mathworks.com/matlabcentral/profile/authors/14382448-christian-seniuktag:it.mathworks.com,2005:Question/4917142019-11-18T14:31:04Z2019-11-18T14:31:04ZUnits for Magnitude after Fast Fourier Transform (FFT) is doneHi all,
I am currently doing vibration analysis for Air Compressors.
I have collected the vibration data signals using accelerometers which gives acceleration units in m/s^2.
My query is that I do not know what is the unit of the Magnitude in the frequency domain plot through the followings codes;
X1 is my Magnitude axis (Y-axis) and f1 is my frequency axis (X-axis).
Any form of help to answer my question on the magnitude is appreciated. Thank you.Fluxshothttps://it.mathworks.com/matlabcentral/profile/authors/15911338-fluxshottag:it.mathworks.com,2005:Question/4917132019-11-18T14:28:56Z2019-11-18T14:28:56Zhow to interface with my own hardwareI would like to use simulink to access a data acquisition device to acquire data for data analysis, but according to simulink's warning, activex support will be removed soon, do you have tutorial on how to use device's .net class in simulink to acquire data?david chanhttps://it.mathworks.com/matlabcentral/profile/authors/16865933-david-chantag:it.mathworks.com,2005:Question/4916792019-11-18T11:28:37Z2019-11-18T14:28:35ZHow is the average and normalization of each column in the table using "for" loop?I have a table with 50x10. In the table, first column is Genes and the second column will be reference column for normalization. Other 8 column will divide reference column. Afterward, this table will be normalized and each column will be averaged after normalization. Therefore there will be one row and 8 columns. How can I do this process in a table. Is it necessary to convert this table to a matrix or dataset, or can we solve it with a simle loop?
I m trying this code for table:
%import data
data = readtable("data.xlsx", "UseExcel", false);
%I coverted table to matrix form by deleting first row
for i = 2:10
res(:,i-1) = data(:,i)./data(:,1);
res_m = mean(res);
end
Bu code is not working as I want and I want to try this with table or dataset form
% Genes gsm335244 gsm335245 gsm335246
% A1CF 1,194 0,848 0,905
% A2M 0,325 6,301 0,607
% A4GALT 1,048 0,592 1,964experthttps://it.mathworks.com/matlabcentral/profile/authors/15223270-experttag:it.mathworks.com,2005:Question/4917102019-11-18T14:10:24Z2019-11-18T14:27:09ZCode works on one pc but not anotherMy collegea and I have been working on a script. I just saw it running on his MAC. He then sendt me the script so that I could work on it, but it will not run on my pc. Any ideas on how this is possible?Christina Sørensenhttps://it.mathworks.com/matlabcentral/profile/authors/7526897-christina-sorensentag:it.mathworks.com,2005:Question/4916472019-11-18T06:20:07Z2019-11-18T14:21:55ZUnexpected Result for 3-D Thermal Transient Analysis of Heat sink using PDE Solver ToolboxI have completed analysis for a heat sink using ANSYS and I'm attempting to validate the results on MATLAB but the transient temperature matrix seems to not change from the intial temperature condition of 60 degrees celcius even though the results are transient. I believe the ANSYS result shows the correct change after 10seconds. The meshing quality is also much better on ANSYS
Link for heatsink 3d model: https://1drv.ms/u/s!AujKksRUPEcroAxpJinCVDnxyrLo?e=4w7FlB
ANSYS RESULT:
MATLAB MODEL:
MATLAB RESULT:
%% Model Setup for Heat Sink
thermalmodel = createpde('thermal','transient');
importGeometry(thermalmodel,'heatsink.stl');
pdegplot(thermalmodel,'FaceLabel','on','FaceAlpha',0.5);
axis equal
%% mesh
generateMesh(thermalmodel,'Hmax',0.4);
figure;
pdeplot3D(thermalmodel);
%% Boundary Condition, Aluminium Alloy Properties and Initial Conditions
TCval = @(location,state)139.3 + 0.204*state.u; %sets thermal conductivity (W/m/°C) as a function of temperature only approximate equation based on linear trend for table data from ansys engineering alumnium alloy data
MDval = 2770; %density kg/m^3
SHval = 875; %specific heat (J/kg/°C)
ATval = 25; %ambient temperature
CCval = 30; %convective film coefficient W/m^2
REval = 0.77; %radiation emissivity
thermalmodel.StefanBoltzmannConstant = 5.670373E-8;
faces = [1,3:30];
thermalProperties(thermalmodel,'ThermalConductivity',TCval,'MassDensity',MDval,'SpecificHeat',SHval);
thermalBC(thermalmodel,'Face',faces,'ConvectionCoefficient',@(region,state)CCval,'AmbientTemperature',ATval);
thermalBC(thermalmodel,'Face',faces,'Emissivity',@(region,state)REval,'AmbientTemperature',ATval);
thermalBC(thermalmodel,'Face',2,'ConvectionCoefficient',5,'AmbientTemperature',ATval);
thermalBC(thermalmodel,'Face',2,'Emissivity',0.1,'AmbientTemperature',ATval);
thermalIC(thermalmodel,60); %sets initial temperature °C problem with this as temp doesnt go down very fast?
%% solve
tlist= [0:10]; %time from 0 to 10seconds
thermalTransientResults = solve(thermalmodel,tlist);
pdeplot3D(thermalmodel,'ColorMapData',thermalTransientResults.Temperature(:,10))
%for n = 1:numel(thermalTransientResults.SolutionTimes)
% figure
% pdeplot3D(thermalmodel,'ColorMapData',thermalTransientResults.Temperature(:,n))
% title(['Temperature at Time = ' num2str(tlist(n))])
%endJake Edwardshttps://it.mathworks.com/matlabcentral/profile/authors/13831422-jake-edwardstag:it.mathworks.com,2005:Question/4917122019-11-18T14:14:21Z2019-11-18T14:14:21ZProblem updating channel. HTTP error code -301#include "ThingSpeak.h"
#include <ESP8266WiFi.h>
char ssid[] = "F"; // your network SSID (name)
char pass[] = "qwerty"; // your network password
int keyIndex = 0; // your network key Index number (needed only for WEP)
WiFiClient client;
unsigned long myChannelNumber = 919998; //SECRET_CH_ID;
const char * myWriteAPIKey = "1D95P000GF21W88Z"; // SECRET_WRITE_APIKEY;
int value1 = 0, value2 = 0, value3 = 0, value4 = 0;
void setup()
{
Serial.begin(9600);
WiFi.mode(WIFI_STA);
ThingSpeak.begin(client); // Initialize ThingSpeak
while (!Serial) {
;
}
}
void loop()
{
// Connect or reconnect to WiFi
if (WiFi.status() != WL_CONNECTED)
{
Serial.print("Attempting to connect to SSID: ");
Serial.println(SECRET_SSID);
while (WiFi.status() != WL_CONNECTED)
{
WiFi.begin(ssid, pass);
Serial.print(".");
delay(5000);
}
Serial.println("\nConnected.");
}
while (!Serial.available());
String incommingStr = Serial.readStringUntil('\n');
Serial.println(incommingStr);
// splitting incomingStr
int data1 = incommingStr.indexOf(','); //finds location of first ,
int value1 = incommingStr.substring(0, data1).toInt(); //captures first data String
int data2 = incommingStr.indexOf(',', data1 + 1 ); //finds location of second ,
int value2 = incommingStr.substring(data1 + 1, data2 + 1).toInt(); //captures second data String
int data3 = incommingStr.indexOf(',', data2 + 1 );
int value3 = incommingStr.substring(data2 + 1, data3 + 1).toInt();
int data4 = incommingStr.indexOf(',', data3 + 1 );
int value4 = incommingStr.substring(data3 + 1).toInt(); //captures remain part of data after last ,
// set the fields with the values
ThingSpeak.setField(1, value1);
ThingSpeak.setField(2, value2);
ThingSpeak.setField(3, value3);
ThingSpeak.setField(4, value4);
Serial.println(String(value1) + " " + String(value2) + " " + String(value3) + " " + String(value4));
// set the status
ThingSpeak.setStatus("4 fields added.");
// write to the ThingSpeak channel
int x = ThingSpeak.writeFields(myChannelNumber, myWriteAPIKey);
if (x == 200)
{
Serial.println("Channel update successful.");
}
else
{
Serial.println("Problem updating channel. HTTP error code " + String(x));
}
delay(20000);
}Ferdib-Al-Islam Ferdibhttps://it.mathworks.com/matlabcentral/profile/authors/11800269-ferdib-al-islam-ferdibtag:it.mathworks.com,2005:Question/4917112019-11-18T14:13:50Z2019-11-18T14:13:50ZError while generating code for STM32F4 Discovery boardHello,
I am trying to communicate with a STM32F4 - Discovery board to let a LED blink. The task has to be done by calling a matlab function which then calls c code. When I run the simulink model with the call to Matlab it shall generate the code for the hardware. Unfortunetely, this results in an error.
If I am correct the error tries to look for a file called matlabfoo_sfun which I do not know why.
I would appreciate your help! Thanks!
Sebastian
The complete error code: Sebastian Linnhttps://it.mathworks.com/matlabcentral/profile/authors/14577861-sebastian-linntag:it.mathworks.com,2005:Question/4674172019-06-17T08:23:09Z2019-11-18T14:11:13Zmatlab file on disk might be emptyWell, I frequently get this error now, which makes it nearly impossible to improve my codes, because I always have to save the file under a new name. Is anyone familiar with this problem (current Windows 10, current Matlab R 2018.b)? I'm grateful for any hints that might solve this issue....
Thanks a lot!
PeterPeter Bäuerlehttps://it.mathworks.com/matlabcentral/profile/authors/4802817-peter-bauerletag:it.mathworks.com,2005:Question/4917082019-11-18T14:06:51Z2019-11-18T14:10:43ZHow to fill a vector with just 2 elements -1 and 1, as a pseudorandom sequence?I am currently experimenting with Matlab's features, and was looking to initialize a vector with just 2 numbers -1 and 1 like a pseudorandom sequence. Tried using the following:
X = randi([-1 1], 1, N);
But the vector contained 0 along with the 2 numbers, and realized the command actually fills up the vector with elements in a given interval [min, max].
Any suggestions on how to fill the vector with just the 2 numbers (only -1 and 1)?
Karthik Ramesh Kamathhttps://it.mathworks.com/matlabcentral/profile/authors/16788406-karthik-ramesh-kamathtag:it.mathworks.com,2005:Question/4917052019-11-18T14:01:55Z2019-11-18T14:08:51ZHow do I check for unresolved requirements links programmatically?I would like to check for any "bad" requirements implementation links as part of a Continuous Integration (CI) workflow.
For example, a "bad" link could be due to a Simulink block being removed.
How would I do this programmtically, i.e. through a MATLAB script?Pat Cannyhttps://it.mathworks.com/matlabcentral/profile/authors/11948165-pat-cannytag:it.mathworks.com,2005:Question/4917092019-11-18T14:08:36Z2019-11-18T14:08:36ZHow do I do simultaneous equations with unknown variables?I have worked out a global stiffness matrix and the global force vector. After this I need to do an equation [K][q] = {f}
Where {q} =
q1
q2
q3
Where q1 is equal to zero, and the other two are values to be found, how do I find these values? When I try, Matlab keeps on saying q2 etc. are undefined. It also doesn't seem to accept F = K*Q for some reason too
Code so far:
Edof = [1 1 2; 2 2 3];
K = zeros (3,3);
F = zeros (3,1);
F (2) = 4;
F (3) = 2;
k1 = 60;
k2 = 30;
Ke1 = [k1 -k1; -k1 k1];
Ke2 = [k2 -k2; -k2 k2];
K(1:2,1:2) = Ke1;
K(2:3,2:3) = K(2:3,2:3) + Ke2;Gowutheyaan Ratnasingamhttps://it.mathworks.com/matlabcentral/profile/authors/13871273-gowutheyaan-ratnasingamtag:it.mathworks.com,2005:Question/4916642019-11-18T09:50:32Z2019-11-18T14:06:49Zdesign filter , Hello everyone, I'm trying to run a script I've written that deals with signal modulation and frequency filtering. unfortunately, the software is crashing at runtime while its deal with the "bode", what can i do?Hello everyone, I'm trying to run a script I've written that deals with signal modulation and frequency filtering. unfortunately, the software is crashing at runtime while its deal with the "bode", what can i do?
clc
close all
clear all
m=1;
am=1.8;
fa=20; %400Hz
ta=1/fa;
t=0:ta/999:6*ta;
ym=am*sin(2*pi*fa*t);
figure(1)
subplot(3,1,1);
plot(t,ym)
title('Modulating signal')
ac=am/m;
fc=400000; %400KHz
% tc=1/fc;
% yc=ac*sin(2*pi*fc*t);
yc= am+ac*square(2*pi*fc*t);
subplot(3,1,2);
plot(t,yc);
grid on;
title('Carrier signal')
y=ac+(1+m*sin(2*pi*fa*t)).*square(2*pi*fc*t);
subplot(3,1,3);
plot(t,y);
title('am signal');
grid on
nfft=length(y);
nfft2=2^nextpow2(nfft);
ff=fft(y,nfft2);
figure(2)
plot(abs(ff))
Fs = length(nfft2);
xdft = fftshift(fft(y));
df = Fs/length(y);
freq = -Fs/2:df:Fs/2-df;
plot(freq,abs(xdft))
Fstop = 350;
Fpass = 400;
Astop = 65;
Apass = 0.5;
Fs = 1e3;
d = designfilt('highpassiir','StopbandFrequency',Fstop ,...
'PassbandFrequency',Fpass,'StopbandAttenuation',Astop, ...
'PassbandRipple',Apass,'SampleRate',Fs,'DesignMethod','butter');
figure(3)
fvtool(d);
[a,b]=tf(d);
filter=tf(a,b);
yfilter=y*filter;
figure(4)
bode(y);Guni Basilianhttps://it.mathworks.com/matlabcentral/profile/authors/13759794-guni-basiliantag:it.mathworks.com,2005:Question/4917072019-11-18T14:06:12Z2019-11-18T14:06:12ZAnnotationPane errors on GuideHi,
When MathWorks will solve the BUGs using guide on 2019b?
I just update to 2019b and it is impossible to work with all those AnnotationPane errors...
Ungoing project stopped, to late to migrate to code based GUIs or the new AppDesign interface.Brunno Machado de Camposhttps://it.mathworks.com/matlabcentral/profile/authors/4338671-brunno-machado-de-campostag:it.mathworks.com,2005:Question/4917062019-11-18T14:06:05Z2019-11-18T14:06:05ZPlot Border of Clusterred DataI want to cluster the data in the attached file to find at which location certain time (period) di dominant. Thus, I want to plot the border of clusterring data in my contour plot.
I find the interesting example in mathworks example:
% border clustering
xy1 = [randn(50,1) randn(50,1)];
xy2 = [randn(50,1)+5 randn(50,1)];
xy3 = [randn(50,1) randn(50,1)+5];
[idx,c] = kmeans([xy1; xy2; xy3],3)
figure
hold on
plot(xy1(:,1),xy1(:,2),'ro')
plot(xy2(:,1),xy2(:,2),'go')
plot(xy3(:,1),xy3(:,2),'bo')
voronoi(c(:,1),c(:,2))
However, I don't know how to implement such code to my data. Some helps, it is really appreciated.
EKedward kabanyashttps://it.mathworks.com/matlabcentral/profile/authors/1278033-edward-kabanyastag:it.mathworks.com,2005:Question/4916922019-11-18T12:49:39Z2019-11-18T14:05:57ZTemperature contour surface plot Hi,
I am trying to generate a 'simple' temperature map of the surface of the ocean for an specific region. However, all I get is altitudinal gradient with no variations across longitudes (see figure). The data comes in three columns: latitude, longitude and temperature.
My code so far:
woa18SST=csvread('woa18_SST_5deg.csv',2,0,[2,0,40507,2]);
woa18SST=array2table(woa18SST,'VariableNames',{'Lat','Lon','SST'});
area1=woa18SST(woa18SST.Lat>=-30,:);
area1=area1(area1.Lat<=25,:);
figure
ax=worldmap([-30 30],[120 200])
load coastlines
surfm(area1.Lat, area1.Lon, area1.SST);
land = shaperead('landareas', 'UseGeoCoords', true);
geoshow(ax, land, 'FaceColor', [0.8 0.7 0.5])
tightmap;Juanhttps://it.mathworks.com/matlabcentral/profile/authors/5884555-juantag:it.mathworks.com,2005:Question/4916422019-11-18T06:06:21Z2019-11-18T14:02:39ZHow to measure object size from an image in real world if distance is known ?I have a task where I have to calculate the size of an object lets say box from image taken through camera. The image resolution and distance between camera and object is known. From what I have seen and undertsand is to first calculate the intrinsic parameters of camera but for that there should be some reference image lets say checkerboard which I found in most examples, to measure the intrinsic parameters.. Based on these parameters we can calculate the object size in real world using parameters from images but I dont get it how will we measure the size of object.
Is there any other way to measure the object size from image or someone who came across the same problem.
Any help will be really appreciated!Muhammad Rakeh Saleemhttps://it.mathworks.com/matlabcentral/profile/authors/14366132-muhammad-rakeh-saleemtag:it.mathworks.com,2005:Question/4915202019-11-17T06:37:00Z2019-11-18T14:02:18ZIs there a way to update the transition matrix of a gridworld environment during each step of RL training?I'm trying to train an agent in an environment that has two reward sources: 1) a source of a static reward probability (let's say 70%), and 2) a source of escalating reward probability (let's say starting at 0% but increasing by 1% with each time the agent tries that source). Is there a way to accomplish this within the established RL framework within MATLAB? For instance, here's what I have set up so far:
singleToneProb = .7;
momentumGain = 0.01;
momentumProb = 0;
mdp = createMDP(["start" "reward" "punish"], ...
["staticChoice" "momentumChoice"]);
mdp.TerminalStates = ["reward";"punish"];
mdp.T(1,2:3,1) = [singleToneProb 1-singleToneProb]; %Set transition matrix
mdp.T(1,2:3,2) = [momentumProb 1-momentumProb];
mdp.R(1,2,1:2) = 1; %Set rewards
env = rlMDPEnv(mdp);
env.ResetFcn = @() 1;
qTable = rlTable(getObservationInfo(env),getActionInfo(env));
critic = rlRepresentation(qTable);
opt = rlQAgentOptions;
%etc. setting agent options
agent = rlQAgent(critic,opt);
trainOpts = rlTrainingOptions;
%etc. setting training options
trainStats = train(agent,env,trainOpts);
Essentially, I would like this to happen with each training step:
if strcmpi(action, 'momentumChoice')
momentumProb = momentumProb + momentumGain;
if momentumProb > 1
momentumProb = 1;
momentumGain = 0;
end
mdp.T(1,2:3,2) = [momentumProb 1-momentumProb];
end
How do I go about doing that without disrupting the agent?
Thanks in advance!Jeffrey Rhoadeshttps://it.mathworks.com/matlabcentral/profile/authors/7679307-jeffrey-rhoadestag:it.mathworks.com,2005:Question/4917032019-11-18T13:55:36Z2019-11-18T14:00:02ZCircle detection for eyeHi everyone, I am stuck with this for weeks. After I input a face image,
First: I perform the viola jones eye region detection by using the vision.CascadeObjectDetector
Second: I perform the Canny edge detection based on the eye region that was detected during the first stage.
a = imread('face.jpg');
imshow(a);
detector = vision.CascadeObjectDetector('EyePairSmall');
bbox = step(detector,a);
out = insertObjectAnnotation (a,'rectangle',bbox,'detection');
subplot(2,2,1),subimage(out);
outb = imcrop(out,bbox);
[hog1,visualization] = extractHOGFeatures(outb,'CellSize',[8 8]);
subplot(2,2,2),subimage(outb);
I = rgb2gray(outb);
BW = edge(I,'canny');
subplot(2,2,3);
imshow(BW);
After that, the image shown is like this:
May I know how can I detect the Iris (circle shape) based on the output of Canny edge detection ?
As the region has will only have two circles detected, how is it possible to be implemented ?
I read about the imfindcircle before, but it doesn't work out. Might need the community helps and some guidance on this.
Much appreciated. Thank you !Teik Jin Limhttps://it.mathworks.com/matlabcentral/profile/authors/9770976-teik-jin-limtag:it.mathworks.com,2005:Question/4913262019-11-15T17:19:46Z2019-11-18T13:57:04ZPlotting cycles of signalHi, I am relatively unexperienced with MATLAB but how do i plot any number of cycles of the following signal;
z(t) = 0 if − π ≤ t < 0
3 if 0 ≤ t ≤ π Ben Hamillhttps://it.mathworks.com/matlabcentral/profile/authors/16465877-ben-hamilltag:it.mathworks.com,2005:Question/4917042019-11-18T13:56:25Z2019-11-18T13:56:25ZDeleting Elements in FEM by using a threshold Hello everybody,
i have some grooves and i need to delete elements in these grooves if the gap width is larger than 2.5 mm.
how can i extract and delete the elements in the groove by using the length of the elements ? all i have is the nodes, the elements and a neighbourmap which shows me which element is my neighbour in the x,y or z direction.
Betim Bahtirihttps://it.mathworks.com/matlabcentral/profile/authors/11290217-betim-bahtiritag:it.mathworks.com,2005:Question/4916972019-11-18T13:20:22Z2019-11-18T13:53:42ZList of Functions Referencing Each OtherIf there is a folder with a multiple subfolders, each containing various .m scripts with functions in them, starting from the main script that calls various functions (each calling other functions and so on), is there a way to visualize which function calls which function as some sort of a connected graph? I am handling a large number of functions calling each other, and having a visualization of some sort of hierarchical structure might help get a better picture of how the program structure.Prabaha Gangopadhyhttps://it.mathworks.com/matlabcentral/profile/authors/13163409-prabaha-gangopadhytag:it.mathworks.com,2005:Question/3312262017-03-22T08:08:03Z2019-11-18T13:52:12Z"The file has been modified outside of MATLAB Editor. Do you want to reload it?" error. How to repair that? I receive error message: "The file has been modified outside of MATLAB Editor. Do you want to reload it?" almost every time when I click somewhere outside Matlab. I receive that error message about 30 times a day. It is really annoying. In fact all my document are saved on network drive but I am only person who works on that documents. It happens for every documents of Matlab. Could you please help me resolve that issue? Marzena Prokopiukhttps://it.mathworks.com/matlabcentral/profile/authors/9901054-marzena-prokopiuktag:it.mathworks.com,2005:Question/4916712019-11-18T10:28:38Z2019-11-18T13:50:31ZHow to remove candidates which are present on blood vessels? Hello,
I am trying to remove pixels which are present on the blood vessels.I have two images ,one is the candidates image and the blood vessels image.I have studied that candidates won't occur on blood vessels.So, i have to eliminate the candidates which are present on blood vessels and get the output image.Can anyone help me with this?
This is the bood vessel image and the candidate image is below as
I want to remove white dots on candidate image which are present on blood vessels in blood vessels image.
Thank youKrishna Chaitanyahttps://it.mathworks.com/matlabcentral/profile/authors/16691867-krishna-chaitanyatag:it.mathworks.com,2005:Question/4917012019-11-18T13:44:02Z2019-11-18T13:44:02Zintegral3 on sum of function handlesHey guys, I am trying to compute some triple integrals of big sum of function handle, but I have some problems with it, could someone help?
Here is my code:
function energy = exactenergy(N,L,str,B)
%UNTITLED2 Summary of this function goes here
% Detailed explanation goes here
R = 3*pi*sqrt(B(N,1)-1)+4;
energy = 0;
if str ==0
R1=0;
f = @(x,y,z) 0;
for j=1:N
for k=1:j
R1 = max([3*pi*(abs(B(j,2))+abs(B(k,2)))+10,3/2*N^(1/3),3*pi*(abs(B(j,3))+abs(B(k,3)))+10,3*pi*(abs(B(j,4))+abs(B(k,4)))+10,R1]);
if k==j
m=1;
end
if round((B(j,2)-B(k,2))/2)-(B(j,2)-B(k,2))/2 == 0
f1 = @(x) 64*pi^4*B(j,2)^2*B(k,2)^2*x.^2.*sin(x/2).^2./((B(j,2)-B(k,2))^2*pi^2-x.^2).^2./((B(j,2)+B(k,2))^2*pi^2-x.^2).^2;
else
f1 = @(x) 64*pi^4*B(j,2)^2*B(k,2)^2*x.^2.*cos(x/2).^2./((B(j,2)-B(k,2))^2*pi^2-x.^2).^2./((B(j,2)+B(k,2))^2*pi^2-x.^2).^2;
end
if round((B(j,3)-B(k,3))/2)-(B(j,3)-B(k,3))/2 == 0
f2 = @(x) 64*pi^4*B(j,3)^2*B(k,3)^2*x.^2.*sin(x/2).^2./((B(j,3)-B(k,3))^2*pi^2-x.^2).^2./((B(j,3)+B(k,3))^2*pi^2-x.^2).^2;
else
f2 = @(x) 64*pi^4*B(j,3)^2*B(k,3)^2*x.^2.*cos(x/2).^2./((B(j,3)-B(k,3))^2*pi^2-x.^2).^2./((B(j,3)+B(k,3))^2*pi^2-x.^2).^2;
end
if round((B(j,4)-B(k,4))/2)-(B(j,4)-B(k,4))/2 == 0
f3 = @(x) 64*pi^4*B(j,4)^2*B(k,4)^2*x.^2.*sin(x/2).^2./((B(j,4)-B(k,4))^2*pi^2-x.^2).^2./((B(j,4)+B(k,4))^2*pi^2-x.^2).^2;
else
f3 = @(x) 64*pi^4*B(j,4)^2*B(k,4)^2*x.^2.*cos(x/2).^2./((B(j,4)-B(k,4))^2*pi^2-x.^2).^2./((B(j,4)+B(k,4))^2*pi^2-x.^2).^2;
end
%energy = energy+m*8*integral3(@(x,y,z) f1(x).*f2(y).*f3(z)./(x.^2+y.^2+z.^2),0,R1,0,R1,0,R1,'AbsTol',1e-4,'RelTol',1e-4);
f = @(x,y,z) f(x,y,z) + m*f1(x).*f2(y).*f3(z)./(x.^2+y.^2+z.^2);
m = 2;
end
j
end
R = max(max(R1));
energy = 8*integral3(f,0,R,0,R,0,R,'AbsTol',1e-3,'RelTol',1e-3);
energy = -1/(2*pi^2*L)*energy;
end
end
The problems are:
1) Is there a more efficient way to perform this integration and stil control the error, for N=200 it takes more than 2 minutes and my initial plan was to compute this integral from N=1:1500.
2) Even though it is slow, everything worked fine untill N=292. When I put N=293 or higher, I get the following error:
Out of memory. The likely cause is an infinite recursion within the program.
Error in exactenergy>@(x,y,z)f(x,y,z)+m*f1(x).*f2(y).*f3(z)./(x.^2+y.^2+z.^2) (line 94)
f = @(x,y,z) f(x,y,z) + m*f1(x).*f2(y).*f3(z)./(x.^2+y.^2+z.^2);
The error seems to come when I call the integral3 command, but I do not know why...
Any help and comments on how to fix it is appreciated, thanksThiago Corsohttps://it.mathworks.com/matlabcentral/profile/authors/7486684-thiago-corsotag:it.mathworks.com,2005:Question/4917002019-11-18T13:41:59Z2019-11-18T13:41:59ZWhich is the best database system for working with a big amount of satellite images?I am working with a big amount of satellite images that I have to process and store the results in a database. This results are then used for another code that work with the data processed from images. I tried to use MySQL in order to store all the data, but it seems to be a bad system because the connection with the database takes too much time when the amount of data is growing. Do you know if there is any database system that can be easly connected with matlab and has some facillities for working with time series images?
Thank you!Enric Alcoverhttps://it.mathworks.com/matlabcentral/profile/authors/9199595-enric-alcovertag:it.mathworks.com,2005:Question/4916562019-11-18T08:07:21Z2019-11-18T13:39:39Zhow do I plot contour lines on orthographic projection? H= 163842×4 double - solution;
he=H(:,4);
lam = linspace(-pi,pi,3901);
theta = linspace(-pi/2,pi/2,42);
[L,T] = meshgrid(lam, theta);
Z = reshape(he,3901,42);
figure;
axesm ortho
geoshow(L*180/pi,T*180/*pi,Z,'DisplayType','contour')
demcmap(Z)
daspectm('m',1)
My result is a blank figure.
Please help me out. I want my solution to be exactly like figure below. Your prompt response will be highly appreciated.
Kayode Odeyemihttps://it.mathworks.com/matlabcentral/profile/authors/11826725-kayode-odeyemitag:it.mathworks.com,2005:Question/4916992019-11-18T13:38:50Z2019-11-18T13:38:50ZConfigure the parameters as arguments of the step functionHello,
I'm trying to generate code where the model parameters are passed as arguments to the step function. I'm not able to find the configuration which enables this.
The step function looks like this:
extern void MODEL_step(MODEL_T *const MODEL_M, Input_Type *arg_In,Output_Type *arg_Out);
But i need something like this:
extern void MODEL_step(MODEL_T *const MODEL_M, Input_Type *arg_In,Output_Type *arg_Out, const Parameters_Type *MODEL_Parameters);
I've already tryed changing the storage clases, editing the storage clases. The closests i get is using the storage class "ImportedExternPointer". Where i get a declaration like this inj the header file:
extern Parameters_Type *MODEL_Parameters;
But this means that if i want to reuse this code N times to represent this model N times, all the N times i use the same parameters, which i don't want.
Any suggestions will be appreciated,Rodrigo Estrellahttps://it.mathworks.com/matlabcentral/profile/authors/16222443-rodrigo-estrellatag:it.mathworks.com,2005:Question/4916842019-11-18T11:54:30Z2019-11-18T13:38:26ZStreamline plot not completeI have been trying to make this streamline plot, unfortunately I have not been able to make it complete. I have looked on different forum pages but was not able to find a solution.
My code:
clear, clc
Gamma=-4;
a=1;
b=1;
Q=1;
[x,y]=meshgrid(-1:0.05:4,-1:0.05:1);
u= (y./(2*pi.*(x.^2+y.^2)))...
+(((2*Q.*b)/((a^2)*pi.*Gamma))...
.*((2*y.*(x-1))./((x.^2+y.^2-2.*x+1).^2)));
v= -((x)./(2.*pi.*(x.^2+y.^2)))...
-(((2*Q*b)./((a^2)*pi.*Gamma))...
*(((x.^2-y.^2-2.*x+1)./((x.^2+y.^2-2.*x+1).^2))));
hold on , clf
figure(1)
quiver(x,y,u,v)
N = 15;
startx = max(x).*rand(N,1);
starty = max(y).*rand(N,1);
streamline(x,y,u,v,startx,starty)
startx2 = -max(x).*rand(N,1);
starty2 = -max(y).*rand(N,1);
streamline(x,y,u,v,startx2,starty2)
startx3 = rand(N,1);
starty3 = rand(N,1);
streamline(x,y,u,v,startx3,starty3)
hold off
Eddwardhttps://it.mathworks.com/matlabcentral/profile/authors/4550918-eddwardtag:it.mathworks.com,2005:Question/4916982019-11-18T13:37:59Z2019-11-18T13:37:59Zhow to generate c-mex s function and tlc file from Matlab Level 1 s-function?I need to convert the Matlab Level 1 S-function to C-mex S-Function along with RTW function and TLC file.
So that it support the .dll generation.Saurabh Suranahttps://it.mathworks.com/matlabcentral/profile/authors/15581899-saurabh-suranatag:it.mathworks.com,2005:Question/4912792019-11-15T13:13:13Z2019-11-18T13:37:34ZIllegal use of reserved keyword "else"Hello everyone.
I'm running a code and I get the aforementioned error for the following part:
% process ratings
formatSpec = '%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,\n';
ratings_matrix = fscanf(fileID, formatSpec, ratings_matrix_size);
if (size(ratings_matrix, 2) > 0)
% check for honeypot question
hp = (ratings_matrix(end,:) == 2 | ratings_matrix(end,:) == 3 | ratings_matrix(end,:) == 4);
if (sum(hp) ~= 0)
disp("Warning: honey-pot check failed.");
index = find(hp, 1);
number_of_dropped_ratings = number_of_dropped_ratings + (size(ratings_matrix, 2) - index + 1);
ratings_matrix = ratings_matrix(:, 1 : index - 1);
number_of_failed_checks = number_of_failed_checks + 1;
end
participant_id_vector = k * ones(1, size(ratings_matrix, 2));
ratings = [ratings; [participant_id_vector; ratings_matrix(3:end,:)]'];
number_of_participants = number_of_participants + 1;
else
nationality(k) = "NULL";
study_level(k) = "NULL";
gender(k) = -1;
age(k) = -1;
end
The error apperas to be in the last else statement but I can't figure out what's wrong. Thank you for your help!Eleonora Ceccaldihttps://it.mathworks.com/matlabcentral/profile/authors/11635148-eleonora-ceccalditag:it.mathworks.com,2005:Question/4916902019-11-18T12:25:49Z2019-11-18T13:37:17ZTo do arithmetic operations with large arrays going out of memory spaceHi, I am working in code that generates large array values which increases with every iteration of monte carlo simulation. To get accurate result, I need to run the code for large iteration values. However, somehere whlike running, the code stops working stating "out of memory". At the end of the loop I need to perform some arithmatic operation on the values of the array generated. Can you please help me on how can I work with large arrays?manishika rawathttps://it.mathworks.com/matlabcentral/profile/authors/9550983-manishika-rawattag:it.mathworks.com,2005:Question/4910742019-11-14T12:29:11Z2019-11-18T13:30:49ZException in thread "Startup Class Loader" and Exception in thread "AWT-EventQueue-0"Hi all, when I am starting Matlab R2019b I get following warning in the command window:
Exception in thread "Startup Class Loader": java.lang.NoClassDefFoundError: Could not initialize class com.mathworks.instutil.InstutilResourceKeys
at com.mathworks.mlwidgets.help.DocCenterRoot.initDocRelease(DocCenterRoot.java:44)
at com.mathworks.mlwidgets.help.DocCenterRoot.<clinit>(DocCenterRoot.java:26)
at com.mathworks.mlwidgets.help.HelpPrefs.<clinit>(HelpPrefs.java:49)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.mathworks.mlservices.MLHelpServices.getDocRoot(MLHelpServices.java:522)
at com.mathworks.mlwidgets.util.productinfo.ProductInfoUtils.getDocrootDirectory(ProductInfoUtils.java:698)
at com.mathworks.mlwidgets.util.productinfo.ProductInfoUtils.getAbsolutePath(ProductInfoUtils.java:685)
at com.mathworks.mlwidgets.util.productinfo.ProductInfoUtils.parseFile(ProductInfoUtils.java:250)
at com.mathworks.mlwidgets.util.productinfo.ProductInfoUtils.parseFiles(ProductInfoUtils.java:310)
at com.mathworks.mlwidgets.util.productinfo.ProductInfoUtils.pathChanged(ProductInfoUtils.java:154)
at com.mathworks.mlwidgets.util.productinfo.ProductInfoUtils.<init>(ProductInfoUtils.java:80)
at com.mathworks.mlwidgets.util.productinfo.ProductInfoUtils.getAllProductsInfo(ProductInfoUtils.java:891)
at com.mathworks.mlwidgets.util.productinfo.ProductInfoUtils.<clinit>(ProductInfoUtils.java:66)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.mathworks.mde.desk.StartupClassLoader$LoadInfo.<init>(StartupClassLoader.java:112)
at com.mathworks.mde.desk.StartupClassLoader.createLoadInfos(StartupClassLoader.java:202)
at com.mathworks.mde.desk.StartupClassLoader.access$500(StartupClassLoader.java:25)
at com.mathworks.mde.desk.StartupClassLoader$2.run(StartupClassLoader.java:223)
at java.lang.Thread.run(Thread.java:748)
Exception in thread "AWT-EventQueue-0": java.lang.NoClassDefFoundError: Could not initialize class com.mathworks.instutil.InstutilResourceKeys
at com.mathworks.matlab_login.MatlabLogin.getInfoToCallEmbeddedLogin(Unknown Source)
at com.mathworks.mde.desk.LoginStatusIndicator.setupLoginButtonAndUI(LoginStatusIndicator.java:224)
at com.mathworks.mde.desk.LoginStatusIndicator.access$100(LoginStatusIndicator.java:53)
at com.mathworks.mde.desk.LoginStatusIndicator$2$1.run(LoginStatusIndicator.java:167)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Does anyone have an idea about what is wrong?
Greetings
ThomasThomas Langhttps://it.mathworks.com/matlabcentral/profile/authors/16373394-thomas-langtag:it.mathworks.com,2005:Question/4916892019-11-18T12:14:42Z2019-11-18T13:23:25ZIs my uint16 image matrix and RGB image?Hi,
I received data set from somewhere and it is matrix of uint16 (spectrogram). I researched and i couldn't find myself a satisfactory answer. Are the unit16 images an rgb images? Is there a way to determine that?ARNhttps://it.mathworks.com/matlabcentral/profile/authors/10580544-arntag:it.mathworks.com,2005:Question/3713132017-12-05T23:00:14Z2019-11-18T13:20:36ZError in solving system of two reaction-diffusion equations?Hello there,
I have a system of two reaction-diffusion equations that I want to solve numerically (attached is the file). However, it doesn't resemble with the standard system used in pdepe.m example. The problems I have are:
*(1)* I don't know how to incorporate it and write c, f, s for my system. As per my knowledge the problem is with the extra term $\gamma \partial u/\partial x$.
*(2)* I tried coding it up but I got an error:
*Warning: Failure at t=2.806210e-02. Unable to meet integration tolerances without reducing the step size below
the smallest value allowed (5.551115e-17) at time t.
> In ode15s (line 730)
In pdepe (line 289)
In pde_bee (line 67)*
Here is the code I wrote:
m = 0; % not sure what m should be for my system of equations
x = [0 0.005 0.01 0.05 0.1 0.2 0.5 0.7 0.9 0.95 0.99 0.995 1];
t = [0 0.005 0.01 0.05 0.1 0.5 1 1.5 2];
sol = pdepe(m,@pdex4pde,@pdex4ic,@pdex4bc,x,t);
u1 = sol(:,:,1);
u2 = sol(:,:,2);
figure;
surf(x,t,u1);
title('u1(x,t)');
xlabel('Distance x');
ylabel('Time t');
figure;
surf(x,t,u2);
title('u2(x,t)');
xlabel('Distance x');
ylabel('Time t');
% --------------------------------------------------------------------------
function [c,f,s] = pdex4pde(x,t,u,DuDx)
delta = 0.5;
gamma = 0.1;
alpha = 0.1;
beta = 0.1;
muB = 0.2;
kB = 0.2;
deltaB = 0.1;
Du1Dx = DuDx(1);
%Du2Dx = DuDx(2);
u1 = u(1); % u in my eqns
u2 = u(2); % v in my eqns
c = [1; 1];
f = [delta*Du1Dx-gamma*u1; 0] .* DuDx;
F = -alpha*u1 + beta*u2;
s = [F; muB*kB*u2^2/(kB^2+u2^2)-deltaB*u2-F];
% --------------------------------------------------------------------------
function u0 = pdex4ic(x)
u0 = [1; 0];
% --------------------------------------------------------------------------
function [pl,ql,pr,qr] = pdex4bc(xl,ul,xr,ur,t)
pl = [0; ul(2)];
ql = [1; 0];
pr = [ur(1)-1; 0];
qr = [0; 1];
Thank you so much for your attention.Rosehttps://it.mathworks.com/matlabcentral/profile/authors/2816791-rose